<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <title>文档</title>
  <link href="./css/semantic/semantic.min.css" rel="stylesheet">
  <link href="./css/oscTree.css" rel="stylesheet">
  <link href="./css/markdown.css" rel="stylesheet">
  <link href="./css/index.css" rel="stylesheet">
</head>
<body>
  <div class="ui container">
    <div id="project-title">
      <div class="title-wrap">
        <div class="left">
          <i class="icon eye"></i>
          文档预览:
          <span id="preview-title"></span>
        </div>
        <div class="right">
          Export by Gitee
        </div>
      </div>
    </div>

    <div class="ui container" id="wiki-preview-container">
      <div id="wiki-preview">
        <div class="ui segment">
          <div class="ui grid page">
            <div class="three wide column doc-list">
              <div class="title">
                <a id="ex-all">
                  收缩全部章节
                </a>
              </div>
              <div class="ztree" id="tree"></div>
            </div>
            <div class="thirteen wide column doc-content">
              <div id="page-detail">
                <div class="title">
                </div>
                <div class="content markdown-body">
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      </div>
  </div>
</body>
</html>
<script src="./js/jquery.min.js"></script>
<script src="./js/ztree.all.js"></script>
<script src="./js/jquery.ztree.exhide.min.js"></script>
<script>
  var zTreeObj;var expandStatus=true;$(document).ready(function(){var setting={view:{showLine:true,showIcon:true},callback:{onClick:function(e,treeId,treeNode){if(treeNode!==null&&!treeNode.isParent&&typeof(treeNode.children)==="undefined"){var sort_id=treeNode.sort_id;var content=json_data.content;for(var c in content){if(c==sort_id){$("#page-detail .title").html(treeNode.name);$("#page-detail .content").html(content[c]);return false}}}else{zTreeObj.expandNode(treeNode)}}},data:{simpleData:{enable:true}}};zTreeObj=$.fn.zTree.init($("#tree"),setting,json_data.title);var first_content=json_data.title[0];$("#page-detail .title").html(first_content.name);$("#page-detail .content").html(json_data.content[first_content.sort_id]);$("#preview-title").html(json_data.preview_title);$("#ex-all").on("click",function(e){zTreeObj.expandAll(!expandStatus);expandStatus=!expandStatus;if(expandStatus){$(this).text("收缩全部章节")}else{$(this).text("展开全部章节")}})});
</script><script>var json_data = {"preview_title":"abel533/Mapper","title":[{"id":"15b86ab","pId":0,"name":"1.integration","parent":"","sort_id":208195,"order":0,"extname":null,"open":true},{"id":"1.1-java","pId":"15b86ab","name":"1.1-java","parent":"1.integration","order":0,"sort_id":208196,"extname":".md","isHidden":false,"content":"### 1.1 Java \u7f16\u7801\u65b9\u5f0f\u96c6\u6210\n\nJava \u7f16\u7801\u65b9\u5f0f\u96c6\u6210\u662f\u6700\u5c11\u89c1\u7684\u4e00\u79cd\u60c5\u51b5\uff0c\u4f46\u662f\u901a\u8fc7\u8fd9\u79cd\u96c6\u6210\u65b9\u5f0f\u53ef\u4ee5\u5f88\u5bb9\u6613\u8ba9\u5927\u5bb6\u770b\u6e05\u901a\u7528 Mapper \u96c6\u6210\u7684\u5165\u53e3\uff0c\u8fd9\u91cc\u4f1a\u63d0\u4f9b\u4e24\u79cd\u65b9\u5f0f\u3002\n\n1.  \u6700\u76f4\u63a5\u7684\u65b9\u5f0f\n2.  \u4f7f\u7528 `Configuration` \u4f5c\u4e3a\u5165\u53e3\u96c6\u6210\n\n#### 1.1.1 \u6dfb\u52a0\u4f9d\u8d56\n\n\u5728\u5f00\u59cb\u5199\u4ee3\u7801\u524d\uff0c\u5148\u628a\u4f9d\u8d56\u6dfb\u52a0\u8fdb\u6765\u3002\n\n\u5728 Java \u7f16\u7801\u96c6\u6210\u65b9\u5f0f\u4e2d\uff0c\u9996\u5148\u4f60\u80af\u5b9a\u5df2\u7ecf\u5f15\u5165\u4e86 MyBatis \u7684\u4f9d\u8d56\uff1a\n\n```xml\n\u003Cdependency\u003E\n  \u003CgroupId\u003Eorg.mybatis\u003C/groupId\u003E\n  \u003CartifactId\u003Emybatis\u003C/artifactId\u003E\n  \u003Cversion\u003E\u7248\u672c\u53f7\u003C/version\u003E\n\u003C/dependency\u003E\n```\n\n\u003E   \u6240\u6709\u7248\u672c\u53f7\u770b\u8fd9\u91cc\uff1ahttp://mvnrepository.com/artifact/org.mybatis/mybatis\n\u003E\n\u003E   \u901a\u7528 Mapper \u652f\u6301 MyBatis 3.2.4+\n\n\u5728 mybatis \u4f9d\u8d56\u7684\u57fa\u7840\u4e0a\uff0c\u6dfb\u52a0\u901a\u7528 Mapper \u7684\u4f9d\u8d56\u5373\u53ef\uff1a\n\n```xml\n\u003Cdependency\u003E\n    \u003CgroupId\u003Etk.mybatis\u003C/groupId\u003E\n    \u003CartifactId\u003Emapper\u003C/artifactId\u003E\n    \u003Cversion\u003E\u6700\u65b0\u7248\u672c\u003C/version\u003E\n\u003C/dependency\u003E\n```\n\n\u003E   \u6700\u65b0\u7248\u672c\u770b\u8fd9\u91cc\uff1ahttp://mvnrepository.com/artifact/tk.mybatis/mapper\n\n*\u5982\u679c\u4f60\u4f7f\u7528\u7684 Jar \u5305\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u4e0a\u9762\u63d0\u4f9b\u7684\u94fe\u63a5\u4e0b\u8f7d Jar\u3002*\n\n#### 1.1.2 \u7f16\u5199\u4ee3\u7801\u96c6\u6210\n\n\u4f7f\u7528 Java \u7f16\u7801\u65b9\u5f0f\u65f6\uff0c\u6b63\u5e38\u60c5\u51b5\u4e0b\u4f60\u90fd\u4f1a\u6709\u6784\u5efa `SqlSessionFactory` \u7684\u4ee3\u7801\u3002\n\n\u5728\u521b\u5efa `SqlSessionFactory` \u5bf9\u8c61**\u524d**\u6216\u8005**\u540e**\u5bf9\u5e94\u4e24\u79cd\u914d\u7f6e\u901a\u7528 Mapper \u7684\u65b9\u6cd5\uff0c\u7531\u4e8e\u6ca1\u6709\u63d0\u4f9b mybatis-config.xml \u6587\u4ef6\u7684\u89e3\u6790\u7c7b\uff0c\u8fd9\u91cc\u4f1a\u63a8\u8350\u4f7f\u7528 **\u521b\u5efa\u540e** \u7684\u65b9\u5f0f\u6765\u521b\u5efa\u3002\n\n##### 1.1.2.1 \u521b\u5efa\u540e\n\n\u5728\u521b\u5efa `SqlSessionFactory` \u540e\uff0c\u5728\u4efb\u4f55\u5176\u4ed6\u8c03\u7528\u53d1\u751f\u524d\uff0c\u4f7f\u7528\u4e0b\u9762\u7684\u65b9\u5f0f\u914d\u7f6e\u901a\u7528 Mapper\u3002\n\n```java\n//\u4ece\u521a\u521a\u521b\u5efa\u7684 sqlSessionFactory \u4e2d\u83b7\u53d6 session\nsession = sqlSessionFactory.openSession();\n//\u521b\u5efa\u4e00\u4e2aMapperHelper\nMapperHelper mapperHelper = new MapperHelper();\n//\u7279\u6b8a\u914d\u7f6e\nConfig config = new Config();\n//\u4e3b\u952e\u81ea\u589e\u56de\u5199\u65b9\u6cd5,\u9ed8\u8ba4\u503cMYSQL,\u8be6\u7ec6\u8bf4\u660e\u8bf7\u770b\u6587\u6863\nconfig.setIDENTITY(\"MYSQL\");\n//\u652f\u6301getter\u548csetter\u65b9\u6cd5\u4e0a\u7684\u6ce8\u89e3\nconfig.setEnableMethodAnnotation(true);\n//\u8bbe\u7f6e insert \u548c update \u4e2d\uff0c\u662f\u5426\u5224\u65ad\u5b57\u7b26\u4e32\u7c7b\u578b!=''\nconfig.setNotEmpty(true);\n//\u6821\u9a8cExample\u4e2d\u7684\u7c7b\u578b\u548c\u6700\u7ec8\u8c03\u7528\u65f6Mapper\u7684\u6cdb\u578b\u662f\u5426\u4e00\u81f4\nconfig.setCheckExampleEntityClass(true);\n//\u542f\u7528\u7b80\u5355\u7c7b\u578b\nconfig.setUseSimpleType(true);\n//\u679a\u4e3e\u6309\u7b80\u5355\u7c7b\u578b\u5904\u7406\nconfig.setEnumAsSimpleType(true);\n//\u81ea\u52a8\u5904\u7406\u5173\u952e\u5b57 - mysql\nconfig.setWrapKeyword(\"`{0}`\");\n//\u8bbe\u7f6e\u914d\u7f6e\nmapperHelper.setConfig(config);\n//\u6ce8\u518c\u901a\u7528\u63a5\u53e3\uff0c\u548c\u5176\u4ed6\u96c6\u6210\u65b9\u5f0f\u4e2d\u7684 mappers \u53c2\u6570\u4f5c\u7528\u76f8\u540c\n//4.0 \u4e4b\u540e\u7684\u7248\u672c\uff0c\u5982\u679c\u7c7b\u4f3c Mapper.class \u8fd9\u6837\u7684\u57fa\u7840\u63a5\u53e3\u5e26\u6709 @RegisterMapper \u6ce8\u89e3\uff0c\u5c31\u4e0d\u5fc5\u5728\u8fd9\u91cc\u6ce8\u518c\nmapperHelper.registerMapper(Mapper.class);\n//\u914d\u7f6e mapperHelper \u540e\uff0c\u6267\u884c\u4e0b\u9762\u7684\u64cd\u4f5c\nmapperHelper.processConfiguration(session.getConfiguration());\n```\n\n\u5982\u679c\u7701\u7565 `Config` \u7684\u914d\u7f6e\uff0c\u4e0a\u8ff0\u4ee3\u7801\u7b80\u5316\u4e3a\uff1a\n\n```java\n//\u4ece\u521a\u521a\u521b\u5efa\u7684 sqlSessionFactory \u4e2d\u83b7\u53d6 session\nsession = sqlSessionFactory.openSession();\n//\u521b\u5efa\u4e00\u4e2aMapperHelper\nMapperHelper mapperHelper = new MapperHelper();\nmapperHelper.processConfiguration(session.getConfiguration());\n```\n\n\u003E   \u901a\u7528 Mapper \u9ed8\u8ba4\u5c31\u662f\u901a\u8fc7 session.getConfiguration() \u83b7\u53d6\u6240\u6709\u7684 MyBatis \u65b9\u6cd5\uff0c\u7136\u540e\u5bf9\u5176\u4e2d\u5c5e\u4e8e\u901a\u7528\u65b9\u6cd5\u7684\u65b9\u6cd5\u8fdb\u884c\u5904\u7406\u3002\n\n##### 1.1.2.2 \u521b\u5efa\u524d\n\n\u521b\u5efa\u524d\u5c31\u662f\u901a\u8fc7\u4f7f\u7528 `tk.mybatis.mapper.session.Configuration` \u66ff\u6362 MyBatis \u4e2d\u7684 `org.apache.ibatis.session.Configuration ` \u6765\u5b9e\u73b0\u3002\u914d\u7f6e\u4ee3\u7801\u5982\u4e0b\uff1a\n\n```java\nConfiguration configuration = new Configuration();\n//\u8fd9\u91cc\u53ef\u4ee5\u53c2\u8003\u4e0a\u9762\u7684\u65b9\u5f0f\u6765\u914d\u7f6e MapperHelper\nconfiguration.setMapperHelper(new MapperHelper());\nsqlSessionFactory = new SqlSessionFactoryBuilder().build(configuration);\n```\n\n\u003E   **\u5b9e\u73b0\u539f\u7406**\uff1a\n\u003E\n\u003E   \u8fd9\u79cd\u914d\u7f6e\u65b9\u5f0f\u662f\u901a\u8fc7\u91cd\u5199\u539f `Configuration` \u4e2d\u7684 `addMappedStatement` \u65b9\u6cd5\u6765\u5b9e\u73b0\u7684\uff1a\n\u003E\n\u003E   ```java\n\u003E   @Override\n\u003E   public void addMappedStatement(MappedStatement ms) {\n\u003E     try {\n\u003E       super.addMappedStatement(ms);\n\u003E       //\u6ca1\u6709\u4efb\u4f55\u914d\u7f6e\u65f6\uff0c\u4f7f\u7528\u9ed8\u8ba4\u914d\u7f6e\n\u003E       if (this.mapperHelper == null) {\n\u003E         this.mapperHelper = new MapperHelper();\n\u003E       }\n\u003E       this.mapperHelper.processMappedStatement(ms);\n\u003E     } catch (IllegalArgumentException e) {\n\u003E       //\u8fd9\u91cc\u7684\u5f02\u5e38\u662f\u5bfc\u81f4 Spring \u542f\u52a8\u6b7b\u5faa\u73af\u7684\u5173\u952e\u4f4d\u7f6e\uff0c\u4e3a\u4e86\u907f\u514d\u540e\u7eed\u4f1a\u541e\u5f02\u5e38\uff0c\u8fd9\u91cc\u76f4\u63a5\u8f93\u51fa\n\u003E       e.printStackTrace();\n\u003E       throw new RuntimeException(e);\n\u003E     }\n\u003E   }\n\u003E   ```\n\n\u901a\u8fc7\u4e0a\u9762\u5176\u4e2d\u4e00\u79cd\u65b9\u5f0f\u914d\u7f6e\u540e\uff0c\u901a\u7528\u65b9\u6cd5\u90fd\u4f1a\u751f\u6548\u3002\n\n\u63a5\u4e0b\u6765\u8bf7\u7ee7\u7eed\u770b\u4e0b\u4e00\u7ae0\u5185\u5bb9\u3002\n\n#### 1.1.3 \u7ec6\u5316\u4f9d\u8d56\u7684\u7528\u6cd5\n\n**\u9996\u5148\u4e0d\u63a8\u8350 Maven \u521d\u5b66\u8005\u770b\u8fd9\u91cc\uff0c\u4e5f\u4e0d\u5efa\u8bae\u901a\u7528 Mapper \u521d\u5b66\u8005\u770b\u8fd9\u91cc**\u3002\n\n\u5728\u51b3\u5b9a\u662f\u5426\u770b\u4e4b\u524d\uff0c\u5148\u770b\u770b\u7ec6\u5316\u4f9d\u8d56\u7528\u6cd5\u7684\u7279\u70b9\uff1a\n\n-   \u53ef\u4ee5\u4ee5\u6700\u7cbe\u7b80\u7684\u65b9\u5f0f\u5f15\u5165\u901a\u7528 Mapper\uff0c\u6309\u7167\u9700\u8981\u5f15\u5165\u3002\n-   \u53ef\u4ee5\u5c06\u67d0\u4e2a\u4f9d\u8d56\u66ff\u6362\u4e3a\u81ea\u5df1\u7684\u5b9e\u73b0\u6216\u8005\u9009\u62e9\u7279\u5b9a\u7248\u672c\u7684\u4f9d\u8d56\uff08\u6bd4\u5982\u67d0\u4e9b\u4f9d\u8d56\u53ef\u4ee5\u9009\u62e9 Java 6 \u6216\u8005 Java 8 \u7684\u7248\u672c\uff09\u3002\n\n\u5f53\u4f60\u9700\u8981\u81ea\u5df1\u9009\u62e9\u5177\u4f53\u7684\u4f9d\u8d56\u65f6\uff0c\u7ee7\u7eed\u770b\u4e0b\u9762\u7684\u4ecb\u7ecd\u3002\n\n\u901a\u7528 Mapper4 \u4e2d\uff0c\u539f\u6765\u7684 `tk.mybatis:mapper` \u9879\u76ee\u5df2\u7ecf\u62c6\u5206\uff0c1.1.1 \u4e2d\u6dfb\u52a0\u7684\u4f9d\u8d56\u662f\u901a\u8fc7\u7279\u6b8a\u6253\u5305\u65b9\u5f0f\u5c06\u6240\u6709\u62c6\u5206\u7684\u9879\u76ee\u5408\u5e76\u5230\u4e86\u4e00\u4e2a jar \u5305\u4e2d\u3002\n\n\u5982\u679c\u9700\u8981\u5bf9\u4f9d\u8d56\u8fdb\u884c\u8be6\u7ec6\u7684\u5b9a\u5236\uff0c\u53ef\u4ee5\u5206\u522b\u5f15\u5165\u4e0b\u9762\u7684\u4f9d\u8d56\uff1a\n\n```xml\n\u003C!-- \u5fc5\u5907\u4f9d\u8d56\uff0c\u63d0\u4f9b\u6838\u5fc3\u529f\u80fd --\u003E\n\u003Cdependency\u003E\n  \u003CgroupId\u003Etk.mybatis\u003C/groupId\u003E\n  \u003CartifactId\u003Emapper-core\u003C/artifactId\u003E\n  \u003Cversion\u003E${mapper-core.version}\u003C/version\u003E\n\u003C/dependency\u003E\n\u003C!-- \u5982\u679c\u9700\u8981\u901a\u7528 Mapper \u81ea\u5e26\u7684 Mapper \u63a5\u53e3\u548c\u7cfb\u5217\u65b9\u6cd5\uff0c\u9700\u8981\u5f15\u5165\u672c\u4f9d\u8d56 --\u003E\n\u003C!-- \u62c6\u5206 base \u9879\u76ee\u7684\u76ee\u7684\u5728\u4e8e\u4ee5\u540e\u53ef\u80fd\u4f1a\u63d0\u4f9b\u5176\u4ed6\u7684\u65b9\u5f0f\u6765\u5b9e\u73b0\u63a5\u53e3 --\u003E\n\u003Cdependency\u003E\n  \u003CgroupId\u003Etk.mybatis\u003C/groupId\u003E\n  \u003CartifactId\u003Emapper-base\u003C/artifactId\u003E\n  \u003Cversion\u003E${mapper-base.version}\u003C/version\u003E\n\u003C/dependency\u003E\n\u003C!-- \u9488\u5bf9\u5f00\u53d1\u4eba\u5458\u7684\u9700\u8981\u63d0\u4f9b\u7684\u4e00\u4e9b\u989d\u5916\u7684\u63a5\u53e3\uff0c\u90fd\u6709\u7279\u6b8a\u7684\u4f7f\u7528\u8981\u6c42 --\u003E\n\u003Cdependency\u003E\n  \u003CgroupId\u003Etk.mybatis\u003C/groupId\u003E\n  \u003CartifactId\u003Emapper-extra\u003C/artifactId\u003E\n  \u003Cversion\u003E${mapper-extra.version}\u003C/version\u003E\n\u003C/dependency\u003E\n\u003C!-- \u57fa\u4e8e Java8 \u65b9\u6cd5\u5f15\u7528\u7684\u7c7b Example \u5bf9\u8c61 Weekend --\u003E\n\u003Cdependency\u003E\n  \u003CgroupId\u003Etk.mybatis\u003C/groupId\u003E\n  \u003CartifactId\u003Emapper-weekend\u003C/artifactId\u003E\n  \u003Cversion\u003E${mapper-weekend.version}\u003C/version\u003E\n\u003C/dependency\u003E\n\u003C!-- \u4ee3\u7801\u751f\u6210\u5668 --\u003E\n\u003Cdependency\u003E\n  \u003CgroupId\u003Etk.mybatis\u003C/groupId\u003E\n  \u003CartifactId\u003Emapper-generator\u003C/artifactId\u003E\n  \u003Cversion\u003E${mapper-generator.version}\u003C/version\u003E\n\u003C/dependency\u003E\n```\n\n\u003E   \u8fd9\u4e9b\u4f9d\u8d56\u7684\u7248\u672c\u53f7\u53ef\u4ee5\u901a\u8fc7 mapper-all \u5b50\u6a21\u5757\u8fdb\u884c\u67e5\u770b\n\u003E\n\u003E   https://github.com/abel533/Mapper/tree/master/mapper-all/pom.xml\n\u003E\n\u003E   \u8fd8\u53ef\u4ee5\u901a\u8fc7\u4e0b\u9762\u7684\u76ee\u5f55\u67e5\u627e\n\u003E\n\u003E   http://central.maven.org/maven2/tk/mybatis/\n\n"},{"id":"1.2-spring","pId":"15b86ab","name":"1.2-spring","parent":"1.integration","order":0,"sort_id":208197,"extname":".md","isHidden":false,"content":"### 1.2 Spring \u96c6\u6210\n\n\u8fd9\u662f MyBatis \u6700\u5e38\u7528\u7684\u4e00\u79cd\u7684\u73af\u5883\u3002\u901a\u7528 Mapper \u63d0\u4f9b\u4e86\u591a\u79cd\u65b9\u5f0f\u6765\u548c Spring \u8fdb\u884c\u96c6\u6210\u3002\n\n#### 1.2.1 \u6dfb\u52a0\u4f9d\u8d56\n\n\u5728\u5f00\u59cb\u914d\u7f6e\u524d\uff0c\u5148\u6dfb\u52a0\u76f8\u5173\u7684\u4f9d\u8d56\u3002\n\n\u6b63\u5e38\u60c5\u51b5\u4e0b\uff0cSpring \u548c MyBatis \u7684\u96c6\u6210\u73af\u5883\u4e2d\uff0c\u5e94\u8be5\u5df2\u7ecf\u5b58\u5728\u4e0b\u9762\u7684\u4f9d\u8d56\uff1a\n\n```xml\n\u003Cdependency\u003E\n  \u003CgroupId\u003Eorg.mybatis\u003C/groupId\u003E\n  \u003CartifactId\u003Emybatis\u003C/artifactId\u003E\n  \u003Cversion\u003E\u7248\u672c\u53f7\u003C/version\u003E\n\u003C/dependency\u003E\n\u003Cdependency\u003E\n  \u003CgroupId\u003Eorg.mybatis\u003C/groupId\u003E\n  \u003CartifactId\u003Emybatis-spring\u003C/artifactId\u003E\n  \u003Cversion\u003E\u7248\u672c\u53f7\u003C/version\u003E\n\u003C/dependency\u003E\n\u003Cdependency\u003E\n  \u003CgroupId\u003Eorg.springframework\u003C/groupId\u003E\n  \u003CartifactId\u003Espring-context\u003C/artifactId\u003E\n  \u003Cversion\u003E\u7248\u672c\u53f7\u003C/version\u003E\n\u003C/dependency\u003E\n\u003Cdependency\u003E\n  \u003CgroupId\u003Eorg.springframework\u003C/groupId\u003E\n  \u003CartifactId\u003Espring-tx\u003C/artifactId\u003E\n  \u003Cversion\u003E\u7248\u672c\u53f7\u003C/version\u003E\n\u003C/dependency\u003E\n\u003Cdependency\u003E\n  \u003CgroupId\u003Eorg.springframework\u003C/groupId\u003E\n  \u003CartifactId\u003Espring-jdbc\u003C/artifactId\u003E\n  \u003Cversion\u003E\u7248\u672c\u53f7\u003C/version\u003E\n\u003C/dependency\u003E\n```\n\n\u003E   \u76f8\u5173\u4f9d\u8d56\u548c\u7248\u672c\u53ef\u4ee5\u901a\u8fc7 http://mvnrepository.com/ \u8fdb\u884c\u641c\u7d22\n\u003E\n\u003E   \u901a\u7528 Mapper \u652f\u6301 MyBatis 3.2.4+\n\n\u96c6\u6210\u901a\u7528 Mapper \u5728\u4e0a\u9762\u7684\u57fa\u7840\u4e0a\u6dfb\u52a0\u4e0b\u9762\u7684\u4f9d\u8d56\uff1a\n\n```xml\n\u003Cdependency\u003E\n    \u003CgroupId\u003Etk.mybatis\u003C/groupId\u003E\n    \u003CartifactId\u003Emapper\u003C/artifactId\u003E\n    \u003Cversion\u003E\u6700\u65b0\u7248\u672c\u003C/version\u003E\n\u003C/dependency\u003E\n```\n\n\u003E   \u901a\u7528 Mapper \u6700\u65b0\u7248\u672c\u770b\u8fd9\u91cc\uff1ahttp://mvnrepository.com/artifact/tk.mybatis/mapper\n\u003E\n\u003E   tk.mybatis:mapper \u4f9d\u8d56\u5305\u542b\u4e86\u901a\u7528 Mapper \u7684\u57fa\u7840\u4ee3\u7801\u4ee5\u53ca\u548c Spring \u96c6\u6210\u5fc5\u987b\u7684\u4ee3\u7801\n\n#### 1.2.2 \u548c Spring \u96c6\u6210\n\n\u548c Spring \u8fdb\u884c\u96c6\u6210\u65f6\uff0c\u5206\u4e3a XML \u548c\u6ce8\u89e3\u914d\u7f6e\u4e24\u79cd\u65b9\u5f0f\uff0c\u6bcf\u79cd\u65b9\u5f0f\u53c8\u6709\u4e0d\u540c\u7684\u914d\u7f6e\u65b9\u5f0f\u3002\n\n*\u8fd9\u91cc\u63d0\u4f9b\u4e86\u5f88\u591a\u914d\u7f6e\u65b9\u5f0f\uff0c\u4f7f\u7528\u65f6\u9009\u62e9\u4e00\u79cd\u6539\u52a8\u6700\u5c0f\u7684\u65b9\u5f0f\u5373\u53ef\uff01*\n\n##### 1.2.2.1 XML \u914d\u7f6e\n\n**1.\u4f7f\u7528 `MapperScannerConfigurer`**\n\n\u548c\u901a\u7528 Mapper \u4ee5\u524d\u7248\u672c\u4e00\u6837\uff0c\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528 tk.mybatis \u63d0\u4f9b\u7684 `tk.mybatis.spring.mapper.MapperScannerConfigurer` \u8fdb\u884c\u914d\u7f6e\uff0c\u8fd9\u4e2a\u914d\u7f6e\u548c MyBatis \u5b98\u65b9\u63d0\u4f9b\u7684 `org.mybatis.spring.mapper.MapperScannerConfigurer` \u533a\u522b\u53ea\u662f\u7b2c\u4e00\u5c42\u7684\u5305\u540d\uff0c`tk` \u548c `org`\u3002\u6240\u4ee5\u4f7f\u7528\u8fd9\u79cd\u65b9\u5f0f\u65f6\uff0c\u5982\u679c\u4f60\u9879\u76ee\u5df2\u7ecf\u4f7f\u7528 `org.` \u8fdb\u884c\u4e86\u914d\u7f6e\uff0c\u53ea\u9700\u8981\u6539\u6210 `tk.` \u5373\u53ef\u3002\n\n```xml\n\u003Cbean class=\"tk.mybatis.spring.mapper.MapperScannerConfigurer\"\u003E\n    \u003Cproperty name=\"basePackage\" value=\"\u626b\u63cf\u5305\u540d\"/\u003E\n\u003C/bean\u003E\n```\n\n\u5982\u679c\u4f60\u9700\u8981\u5bf9\u901a\u7528 Mapper \u8fdb\u884c\u7279\u6b8a\u914d\u7f6e\uff0c\u53ef\u4ee5\u6309\u4e0b\u9762\u7684\u65b9\u5f0f\u8fdb\u884c\u914d\u7f6e\uff1a\n\n```xml\n\u003Cbean class=\"tk.mybatis.spring.mapper.MapperScannerConfigurer\"\u003E\n    \u003Cproperty name=\"basePackage\" value=\"tk.mybatis.mapper.mapper\"/\u003E\n    \u003Cproperty name=\"sqlSessionFactoryBeanName\" value=\"sqlSessionFactory\"/\u003E\n    \u003Cproperty name=\"properties\"\u003E\n        \u003Cvalue\u003E\n            \u53c2\u6570\u540d=\u503c\n            \u53c2\u6570\u540d2=\u503c2\n            ...\n        \u003C/value\u003E\n    \u003C/property\u003E\n\u003C/bean\u003E\n```\n\n\u003E   \u53ef\u7528\u914d\u7f6e\u7684\u53c2\u6570\u8bf7\u770b\u540e\u7eed\u7684\u914d\u7f6e\u6587\u6863\uff0c\u914d\u7f6e\u53c2\u6570\u65f6\u4e00\u884c\u5199\u4e00\u4e2a\u503c\u3002\n\n**2.XML \u914d\u7f6e\u4f7f\u7528 `Configuration`**\n\n\u5982\u679c\u67d0\u4e9b\u7b2c\u4e09\u65b9\u4e5f\u9700\u8981\u7279\u6b8a\u7684 `MapperScannerConfigurer` \u65f6\uff0c\u5c31\u4e0d\u80fd\u7528\u4e0a\u9762\u7684\u65b9\u5f0f\u8fdb\u884c\u914d\u7f6e\u4e86\uff0c\u6b64\u65f6\u53ef\u4ee5\u9009\u62e9\u4e0b\u9762\u8fd9\u79cd\u65b9\u5f0f\uff0c\u8fd9\u79cd\u65b9\u5f0f\u8981\u6c42\u4f7f\u7528MyBatis (3.4.0+) \u548c mybatis-spring (1.3.0+)\uff0c\u914d\u7f6e\u65b9\u5f0f\u5982\u4e0b\uff1a\n\n```xml\n\u003C!--\u4f7f\u7528 Configuration \u65b9\u5f0f\u8fdb\u884c\u914d\u7f6e--\u003E\n\u003Cbean id=\"mybatisConfig\" class=\"tk.mybatis.mapper.session.Configuration\"\u003E\n    \u003C!-- \u914d\u7f6e\u901a\u7528 Mapper\uff0c\u6709\u4e09\u79cd\u5c5e\u6027\u6ce8\u5165\u65b9\u5f0f --\u003E\n    \u003Cproperty name=\"mapperProperties\"\u003E\n        \u003Cvalue\u003E\n            notEmpty=true\n        \u003C/value\u003E\n    \u003C/property\u003E\n\u003C/bean\u003E\n\n\u003Cbean id=\"sqlSessionFactory\" class=\"org.mybatis.spring.SqlSessionFactoryBean\"\u003E\n    \u003Cproperty name=\"dataSource\" ref=\"dataSource\"/\u003E\n    \u003Cproperty name=\"configuration\" ref=\"mybatisConfig\"/\u003E\n\u003C/bean\u003E\n\n\u003C!-- \u4e0d\u9700\u8981\u8003\u8651\u4e0b\u9762\u8fd9\u4e2a\uff0c\u6ce8\u610f\u8fd9\u91cc\u662f org \u7684 --\u003E\n\u003Cbean class=\"org.mybatis.spring.mapper.MapperScannerConfigurer\"\u003E\n    \u003Cproperty name=\"basePackage\" value=\"tk.mybatis.mapper.configuration\"/\u003E\n    \u003Cproperty name=\"sqlSessionFactoryBeanName\" value=\"sqlSessionFactory\"/\u003E\n\u003C/bean\u003E\n```\n\n\u8fd9\u91cc\u4f7f\u7528\u4e86 `tk.mybatis.mapper.session.Configuration` \uff0c\u4e5f\u5c31\u662f\u4e0d\u80fd\u901a\u8fc7\u8bfb\u53d6 `mybatis-config.xml` \u8fdb\u884c\u914d\u7f6e\uff0c\u4e0a\u9762\u8fd9\u79cd\u914d\u7f6e\u66f4\u76f4\u63a5\uff0c\u4f7f\u7528 Spring setter \u914d\u7f6e\u5c5e\u6027\u66f4\u65b9\u4fbf\u3002\u5f53\u9700\u8981\u914d\u7f6e\u901a\u7528 Mapper \u65f6\uff0c\u4f7f\u7528 `mapperProperties` \u5c5e\u6027\u914d\u7f6e\u5373\u53ef\uff0c\u914d\u7f6e\u65b9\u5f0f\u548c\u524d\u9762\u7684\u76f8\u540c\uff0c\u4e00\u884c\u4e00\u4e2a\u914d\u7f6e\u5373\u53ef\u3002\n\n\u914d\u7f6e\u4e86\u4e00\u4e2a mybatisConfig \u7684 bean \u540e\uff0c\u5728 `SqlSessionFactoryBean` \u4e2d\u6ce8\u5165\u5373\u53ef\u3002\n\n\u540e\u9762\u7684 `MapperScannerConfigurer` \u53ea\u662f\u4e3a\u4e86\u8bf4\u660e\u8fd9\u91cc\u4e0d\u9700\u8981\u4f7f\u7528 `tk.` \u5f00\u5934\u7684\u7c7b\u8fdb\u884c\u914d\u7f6e\u3002\n\n\u8fd9\u79cd\u914d\u7f6e\u65b9\u5f0f\u57fa\u672c\u4e0a\u548c\u4efb\u4f55\u7b2c\u4e09\u65b9\u90fd\u4e0d\u4f1a\u51b2\u7a81\uff0c\u5982\u679c\u4f60\u9047\u5230\u4e86\u7b2c\u4e09\u65b9\u91cd\u5199 `SqlSessionFactoryBean` \u7684\u60c5\u51b5\uff0c\u5c31\u4f7f\u7528\u524d\u4e00\u79cd\u65b9\u5f0f\u914d\u7f6e\u5373\u53ef\u3002\n\n##### 1.2.2.2 \u4f7f\u7528 `@MapperScan` \u6ce8\u89e3\n\n\u5982\u679c\u8981\u4f7f\u7528\u8be5\u6ce8\u89e3\u8fdb\u884c\u914d\u7f6e\uff0c\u8bf7\u786e\u8ba4\u9009\u62e9\u7684\u662f `tk.mybatis.spring.annotation.MapperScan` \u6ce8\u89e3\uff08\u5fc5\u987b\u4f7f\u7528\u5b98\u65b9\u7684\u6ce8\u89e3\u65f6\uff0c\u770b\u4e0b\u9762\u5176\u4ed6\u914d\u7f6e\u65b9\u5f0f\uff09\u3002\n\n`tk` \u63d0\u4f9b\u7684\u8fd9\u4e2a\u6ce8\u89e3\u76f8\u6bd4\u5b98\u65b9\u7684\u591a\u4e86\u4e0b\u9762\u4e24\u4e2a\u5c5e\u6027\uff1a\n\n```java\n/**\n * \u901a\u7528 Mapper \u7684\u914d\u7f6e\uff0c\u4e00\u884c\u4e00\u4e2a\u914d\u7f6e\n *\n * @return\n */\nString[] properties() default {};\n\n/**\n * \u8fd8\u53ef\u4ee5\u76f4\u63a5\u914d\u7f6e\u4e00\u4e2a MapperHelper bean\n *\n * @return\n */\nString mapperHelperRef() default \"\";\n```\n\n\u8fd9\u4e24\u4e2a\u914d\u7f6e\u65b9\u5f0f\u4e2d\uff0c`mapperHelperRef` \u4f18\u5148\u7ea7\u66f4\u9ad8\uff0c\u53ea\u9700\u8981\u9009\u62e9\u5176\u4e2d\u4e00\u79cd\u65b9\u5f0f\u8fdb\u884c\u914d\u7f6e\u5373\u53ef\u3002\n\n**1.\u4f7f\u7528 `properties` \u914d\u7f6e\u65f6\uff1a**\n\n```java\n@Configuration\n@MapperScan(value = \"tk.mybatis.mapper.annotation\",\n    properties = {\n            \"mappers=tk.mybatis.mapper.common.Mapper\",\n            \"notEmpty=true\"\n    }\n)\npublic class MyBatisConfigProperties {\n```\n\n\u548c XML \u4e2d\u5f88\u50cf\uff0c\u4ecd\u7136\u4e00\u4e2a\u4e00\u4e2a\u914d\u7f6e\u3002\n\n**2.\u4f7f\u7528 `mapperHelperRef` \u914d\u7f6e\u65f6\uff1a**\n\n```java\n@Configuration\n@MapperScan(value = \"tk.mybatis.mapper.annotation\", mapperHelperRef = \"mapperHelper\")\npublic static class MyBatisConfigRef {\n    //\u5176\u4ed6\n \n    @Bean\n    public MapperHelper mapperHelper() {\n        Config config = new Config();\n        List\u003CClass\u003E mappers = new ArrayList\u003CClass\u003E();\n        mappers.add(Mapper.class);\n        config.setMappers(mappers);\n\n        MapperHelper mapperHelper = new MapperHelper();\n        mapperHelper.setConfig(config);\n        return mapperHelper;\n    }\n}\n```\n\n\u8fd9\u91cc\u914d\u7f6e `mapperHelperRef = \"mapperHelper\"`\uff0c\u5e76\u4e14\u63d0\u4f9b\u4e86\u4e00\u4e2a\u540d\u4e3a `mapperHelper` \u7684 `bean`\u3002\u5bf9\u901a\u7528 Mapper \u7684\u4efb\u4f55\u914d\u7f6e\u76f4\u63a5\u901a\u8fc7\u7f16\u7801\u5bf9 MapperHelper \u8fdb\u884c\u914d\u7f6e\u3002\n\n**3.\u4f7f\u7528 `Configuration` \u8fdb\u884c\u914d\u7f6e**\n\n\u8fd9\u91cc\u53ef\u4ee5\u4f7f\u7528 tk \u6216\u8005 MyBatis \u5b98\u65b9\u7684 `@MapperScan` \u6ce8\u89e3\u3002\n\n```java\n@Configuration\n@MapperScan(value = \"tk.mybatis.mapper.annotation\")\npublic static class MyBatisConfigRef {\n\n    @Bean\n    public SqlSessionFactory sqlSessionFactory() throws Exception {\n        SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();\n        sessionFactory.setDataSource(dataSource());\n        //tk.mybatis.mapper.session.Configuration\n        Configuration configuration = new Configuration();\n        //\u53ef\u4ee5\u5bf9 MapperHelper \u8fdb\u884c\u914d\u7f6e\u540e set\n        configuration.setMapperHelper(new MapperHelper());\n        //\u8bbe\u7f6e\u4e3a tk \u63d0\u4f9b\u7684 Configuration\n        sessionFactory.setConfiguration(configuration);\n        return sessionFactory.getObject();\n    }\n}\n```\n\n\u003E    `@MapperScan` \u6ce8\u89e3\u5728 Spring Boot \u96c6\u6210\u4e2d\u8fd8\u4f1a\u63d0\u5230\u3002\n\n\u6587\u6863\u5230\u8fd9\u91cc\u5c31\u96c6\u6210\u597d\u901a\u7528 Mapper \u4e86\uff0c\u63a5\u4e0b\u6765\u8bf7\u7ee7\u7eed\u770b\u4e0b\u4e00\u7ae0\u5185\u5bb9\u3002\n\n#### 1.2.3 \u7ec6\u5316\u4f9d\u8d56\u7684\u7528\u6cd5\n\n**\u9996\u5148\u4e0d\u63a8\u8350 Maven \u521d\u5b66\u8005\u770b\u8fd9\u91cc\uff0c\u4e5f\u4e0d\u5efa\u8bae\u901a\u7528 Mapper \u521d\u5b66\u8005\u770b\u8fd9\u91cc**\u3002\n\n\u5728\u51b3\u5b9a\u662f\u5426\u770b\u4e4b\u524d\uff0c\u5148\u770b\u770b\u7ec6\u5316\u4f9d\u8d56\u7528\u6cd5\u7684\u7279\u70b9\uff1a\n\n-   \u53ef\u4ee5\u4ee5\u6700\u7cbe\u7b80\u7684\u65b9\u5f0f\u5f15\u5165\u901a\u7528 Mapper\uff0c\u6309\u7167\u9700\u8981\u5f15\u5165\u3002\n-   \u53ef\u4ee5\u5c06\u67d0\u4e2a\u4f9d\u8d56\u66ff\u6362\u4e3a\u81ea\u5df1\u7684\u5b9e\u73b0\u6216\u8005\u9009\u62e9\u7279\u5b9a\u7248\u672c\u7684\u4f9d\u8d56\uff08\u6bd4\u5982\u67d0\u4e9b\u4f9d\u8d56\u53ef\u4ee5\u9009\u62e9 Java 6 \u6216\u8005 Java 8 \u7684\u7248\u672c\uff09\u3002\n-   \u652f\u6301 Spring \u9ad8\u7248\u672c\u7684\u7279\u6b8a\u7528\u6cd5\uff08\u4f8b\u5982\u591a\u4e2a `@MapperScan`\u6ce8\u89e3\uff0c\u6682\u65f6\u8fd8\u6ca1\u63d0\u4f9b\uff09\n\n\u901a\u7528 Mapper4 \u4e2d\uff0c\u539f\u6765\u7684 `tk.mybatis:mapper` \u9879\u76ee\u5df2\u7ecf\u62c6\u5206\uff0c1.2.1 \u4e2d\u6dfb\u52a0\u7684\u4f9d\u8d56\u662f\u901a\u8fc7\u7279\u6b8a\u6253\u5305\u65b9\u5f0f\u5c06\u6240\u6709\u62c6\u5206\u7684\u9879\u76ee\u5408\u5e76\u5230\u4e86\u4e00\u4e2a jar \u5305\u4e2d\u3002\n\n\u5982\u679c\u9700\u8981\u5bf9\u4f9d\u8d56\u8fdb\u884c\u8be6\u7ec6\u7684\u5b9a\u5236\uff0c\u53ef\u4ee5\u5206\u522b\u5f15\u5165\u4e0b\u9762\u7684\u4f9d\u8d56\uff1a\n\n```xml\n\u003C!-- \u5fc5\u5907\u4f9d\u8d56\uff0c\u63d0\u4f9b\u6838\u5fc3\u529f\u80fd --\u003E\n\u003Cdependency\u003E\n  \u003CgroupId\u003Etk.mybatis\u003C/groupId\u003E\n  \u003CartifactId\u003Emapper-core\u003C/artifactId\u003E\n  \u003Cversion\u003E${mapper-core.version}\u003C/version\u003E\n\u003C/dependency\u003E\n\u003C!-- \u5982\u679c\u9700\u8981\u901a\u7528 Mapper \u81ea\u5e26\u7684 Mapper \u63a5\u53e3\u548c\u7cfb\u5217\u65b9\u6cd5\uff0c\u9700\u8981\u5f15\u5165\u672c\u4f9d\u8d56 --\u003E\n\u003C!-- \u62c6\u5206 base \u9879\u76ee\u7684\u76ee\u7684\u5728\u4e8e\u4ee5\u540e\u53ef\u80fd\u4f1a\u63d0\u4f9b\u5176\u4ed6\u7684\u65b9\u5f0f\u6765\u5b9e\u73b0\u63a5\u53e3 --\u003E\n\u003Cdependency\u003E\n  \u003CgroupId\u003Etk.mybatis\u003C/groupId\u003E\n  \u003CartifactId\u003Emapper-base\u003C/artifactId\u003E\n  \u003Cversion\u003E${mapper-base.version}\u003C/version\u003E\n\u003C/dependency\u003E\n\u003C!-- \u9488\u5bf9\u5f00\u53d1\u4eba\u5458\u7684\u9700\u8981\u63d0\u4f9b\u7684\u4e00\u4e9b\u989d\u5916\u7684\u63a5\u53e3\uff0c\u90fd\u6709\u7279\u6b8a\u7684\u4f7f\u7528\u8981\u6c42 --\u003E\n\u003Cdependency\u003E\n  \u003CgroupId\u003Etk.mybatis\u003C/groupId\u003E\n  \u003CartifactId\u003Emapper-extra\u003C/artifactId\u003E\n  \u003Cversion\u003E${mapper-extra.version}\u003C/version\u003E\n\u003C/dependency\u003E\n\u003C!-- \u57fa\u4e8e Java8 \u65b9\u6cd5\u5f15\u7528\u7684\u7c7b Example \u5bf9\u8c61 Weekend --\u003E\n\u003Cdependency\u003E\n  \u003CgroupId\u003Etk.mybatis\u003C/groupId\u003E\n  \u003CartifactId\u003Emapper-weekend\u003C/artifactId\u003E\n  \u003Cversion\u003E${mapper-weekend.version}\u003C/version\u003E\n\u003C/dependency\u003E\n\u003C!-- \u4ee3\u7801\u751f\u6210\u5668 --\u003E\n\u003Cdependency\u003E\n  \u003CgroupId\u003Etk.mybatis\u003C/groupId\u003E\n  \u003CartifactId\u003Emapper-generator\u003C/artifactId\u003E\n  \u003Cversion\u003E${mapper-generator.version}\u003C/version\u003E\n\u003C/dependency\u003E\n\u003C!-- Spring \u96c6\u6210\u5fc5\u5907 --\u003E\n\u003Cdependency\u003E\n  \u003CgroupId\u003Etk.mybatis\u003C/groupId\u003E\n  \u003CartifactId\u003Emapper-spring\u003C/artifactId\u003E\n  \u003Cversion\u003E${mapper-spring.version}\u003C/version\u003E\n\u003C/dependency\u003E\n```\n\n\u003E   \u8fd9\u4e9b\u4f9d\u8d56\u7684\u7248\u672c\u53f7\u53ef\u4ee5\u901a\u8fc7 mapper-all \u5b50\u6a21\u5757\u8fdb\u884c\u67e5\u770b\n\u003E\n\u003E   https://github.com/abel533/Mapper/tree/master/mapper-all/pom.xml\n\u003E\n\u003E   \u8fd8\u53ef\u4ee5\u901a\u8fc7\u4e0b\u9762\u7684\u76ee\u5f55\u67e5\u627e\n\u003E\n\u003E   http://central.maven.org/maven2/tk/mybatis/"},{"id":"1.3-spring-boot","pId":"15b86ab","name":"1.3-spring-boot","parent":"1.integration","order":0,"sort_id":208198,"extname":".md","isHidden":false,"content":"### 1.3 Spring Boot \u96c6\u6210\n\nSpring Boot \u5728\u5fae\u670d\u52a1\u9886\u57df\u4e2d\u5df2\u7ecf\u6210\u4e3a\u4e3b\u6d41\u3002\n\n\u8fd9\u91cc\u4ecb\u7ecd\u901a\u7528 Mapper \u5982\u4f55\u540c Spring Boot \u8fdb\u884c\u96c6\u6210\u3002\n\n\u4e3a\u4e86\u80fd\u9002\u5e94\u5404\u79cd\u60c5\u51b5\u7684\u7528\u6cd5\uff0c\u8fd9\u91cc\u4e5f\u63d0\u4f9b\u4e86\u591a\u79cd\u96c6\u6210\u65b9\u5f0f\uff0c\u57fa\u672c\u4e0a\u5206\u4e3a\u4e24\u5927\u7c7b\u3002\n\n-   \u57fa\u4e8e starter \u7684\u81ea\u52a8\u914d\u7f6e\n-   \u57fa\u4e8e `@MapperScan` \u6ce8\u89e3\u7684\u624b\u5de5\u914d\u7f6e\n\n##### 1.3.1 mapper-spring-boot-starter\n\n\u4f60\u53ea\u9700\u8981\u6dfb\u52a0\u901a\u7528 Mapper \u63d0\u4f9b\u7684 starter \u5c31\u5b8c\u6210\u4e86\u6700\u57fa\u672c\u7684\u96c6\u6210\uff0c\u4f9d\u8d56\u5982\u4e0b\uff1a\n\n```xml\n\u003Cdependency\u003E\n  \u003CgroupId\u003Etk.mybatis\u003C/groupId\u003E\n  \u003CartifactId\u003Emapper-spring-boot-starter\u003C/artifactId\u003E\n  \u003Cversion\u003E\u7248\u672c\u53f7\u003C/version\u003E\n\u003C/dependency\u003E\n```\n[![Maven central](https://maven-badges.herokuapp.com/maven-central/tk.mybatis/mapper-spring-boot-starter/badge.svg)](https://maven-badges.herokuapp.com/maven-central/tk.mybatis/mapper-spring-boot-starter)\n\n\u003E   \u6700\u65b0\u7248\u672c\u53f7\u5982\u4e0a\u6240\u793a\uff0c\u4f60\u4e5f\u53ef\u4ee5\u4ece\u4e0b\u9762\u5730\u5740\u67e5\u770b\uff1a\n\u003E\n\u003E   http://mvnrepository.com/artifact/tk.mybatis/mapper-spring-boot-starter\n\u003E\n\u003E   **\u6ce8\u610f\uff1a\u5f15\u5165\u8be5 starter \u65f6\uff0c\u548c MyBatis \u5b98\u65b9\u7684 starter \u6ca1\u6709\u51b2\u7a81\uff0c\u4f46\u662f\u5b98\u65b9\u7684\u81ea\u52a8\u914d\u7f6e\u4e0d\u4f1a\u751f\u6548\uff01**\n\n\u5982\u679c\u4f60\u9700\u8981\u5bf9\u901a\u7528 Mapper \u8fdb\u884c\u914d\u7f6e\uff0c\u4f60\u53ef\u4ee5\u5728 Spring Boot \u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u914d\u7f6e `mapper.` \u524d\u7f00\u7684\u914d\u7f6e\u3002\n\n\u4f8b\u5982\u5728 yml \u683c\u5f0f\u4e2d\u914d\u7f6e\uff1a\n```yml\nmapper:\n  mappers:\n    - tk.mybatis.mapper.common.Mapper\n    - tk.mybatis.mapper.common.Mapper2\n  notEmpty: true\n```\n\n\u5728 propertie \u914d\u7f6e\u4e2d\uff1a\n```properties\nmapper.mappers=tk.mybatis.mapper.common.Mapper,tk.mybatis.mapper.common.Mapper2\nmapper.notEmpty=true\n```\n\u7531\u4e8e Spring Boot \u652f\u6301 Relax \u65b9\u5f0f\u7684\u53c2\u6570\uff0c\u56e0\u6b64\u4f60\u5728\u914d\u7f6e `notEmpty` \u65f6\u66f4\u591a\u7684\u662f\u7528 `not-empty`\uff0c\u4e5f\u53ea\u6709\u5728 Spring Boot \u4e2d\u4f7f\u7528\u7684\u65f6\u5019\u53c2\u6570\u540d\u4e0d\u5fc5\u548c\u914d\u7f6e\u4e2d\u7684\u5b8c\u5168\u4e00\u81f4\u3002\n\n\u003E   \u5982\u679c\u4f60\u5bf9 Spring Boot \u7684 Environment \u4e86\u89e3\uff0c\u4f60\u53ef\u4ee5\u7528 Spring Boot \u652f\u6301\u7684\u6240\u6709\u65b9\u5f0f\u8fdb\u884c\u914d\u7f6e\u3002\n\n\u5173\u4e8e\u901a\u7528 Mapper \u652f\u6301\u7684\u6240\u6709\u914d\u7f6e\u8bf7\u770b\u540e\u7eed\u7684\u6587\u6863\u3002\n\n##### 1.3.2  `@MapperScan` \u6ce8\u89e3\u914d\u7f6e \n\n\u4f60\u53ef\u4ee5\u7ed9\u5e26\u6709 `@Configuration` \u7684\u7c7b\u914d\u7f6e\u8be5\u6ce8\u89e3\uff0c\u6216\u8005\u76f4\u63a5\u914d\u7f6e\u5230 Spring Boot \u7684\u542f\u52a8\u7c7b\u4e0a\uff0c\u5982\u4e0b\uff1a\n\n```java\n@tk.mybatis.spring.annotation.MapperScan(basePackages = \"\u626b\u63cf\u5305\")\n@SpringBootApplication\npublic class SampleMapperApplication implements CommandLineRunner {\n```\n\n**\u6ce8\u610f\uff1a\u8fd9\u91cc\u4f7f\u7528\u7684 `tk.mybatis.spring.annotation.MapperScan` !**\n\n\u4f60\u53ef\u4ee5\u76f4\u63a5\u5728 Spring Boot \u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u76f4\u63a5\u914d\u7f6e\u901a\u7528 Mapper\uff08\u53c2\u80031.3.1\u4e2d\u7684\u914d\u7f6e\uff09\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528\u6ce8\u89e3\u4e2d\u63d0\u4f9b\u7684\u4e24\u4e2a\u5c5e\u6027\u8fdb\u884c\u914d\u7f6e\uff1a\n\n```java\n/**\n * \u901a\u7528 Mapper \u7684\u914d\u7f6e\uff0c\u4e00\u884c\u4e00\u4e2a\u914d\u7f6e\n *\n * @return\n */\nString[] properties() default {};\n\n/**\n * \u8fd8\u53ef\u4ee5\u76f4\u63a5\u914d\u7f6e\u4e00\u4e2a MapperHelper bean\n *\n * @return\n */\nString mapperHelperRef() default \"\";\n```\n\n\u4f7f\u7528\u8fd9\u79cd\u65b9\u5f0f\u8fdb\u884c\u914d\u7f6e\u65f6\uff0c\u8bf7\u53c2\u8003 1.2.2.2 \u4e2d\u7684\u5185\u5bb9\u3002\n\n\u003E   \u6ce8\u610f\uff1a\u8fd9\u4e24\u4e2a\u5c5e\u6027\u914d\u7f6e\u65b9\u5f0f\u7684\u4f18\u5148\u7ea7\u66f4\u9ad8\uff0c\u6240\u4ee5\u5efa\u8bae\u5728 Spring Boot \u4e2d\u901a\u8fc7\u914d\u7f6e\u6587\u4ef6\uff08\u6216 Environment\uff09\u914d\u7f6e\u3002\n\n\u63a5\u4e0b\u6765\u8bf7\u7ee7\u7eed\u770b\u4e0b\u4e00\u7ae0\u5185\u5bb9\u3002"},{"id":"1.integration","pId":"15b86ab","name":"1.integration","parent":"1.integration","order":0,"sort_id":208199,"extname":".md","isHidden":false,"content":"## \u4e00\u3001\u96c6\u6210\u901a\u7528 Mapper\n\n\u901a\u7528 Mapper \u6709\u5f88\u591a\u79cd\u96c6\u6210\u65b9\u5f0f\uff0c\u8fd9\u91cc\u4f1a\u4ecb\u7ecd\u5927\u90e8\u5206\u60c5\u51b5\u4e0b\u7684\u914d\u7f6e\u65b9\u5f0f\u3002\n\nJava \u7f16\u7801\u65b9\u5f0f\u96c6\u6210\u662f\u6700\u5c11\u89c1\u7684\u4e00\u79cd\u60c5\u51b5\uff0c\u4f46\u662f\u901a\u8fc7\u8fd9\u79cd\u96c6\u6210\u65b9\u5f0f\u53ef\u4ee5\u5f88\u5bb9\u6613\u8ba9\u5927\u5bb6\u770b\u6e05\u901a\u7528 Mapper \u96c6\u6210\u7684\u5165\u53e3\u3002\n\n\u548c Spring \u96c6\u6210\u662f\u6700\u5e38\u89c1\u7684\uff0cSpring Boot \u4e5f\u5728\u6162\u6162\u6210\u4e3a\u4e3b\u6d41\uff0c\u4e3a\u4e86\u4fbf\u4e8e\u5728\u96c6\u6210\u901a\u7528 Mapper \u7684\u60c5\u51b5\u4e0b\u4ecd\u7136\u53ef\u4ee5\u548c\u7b2c\u4e09\u65b9\u7684\u5de5\u5177\u96c6\u6210\uff0c\u8fd9\u91cc\u4e5f\u4f1a\u6709\u5f88\u591a\u79cd\u96c6\u6210\u7684\u65b9\u5f0f\u3002\n\n-------------------\n\n### [1.1 Java \u7f16\u7801\u65b9\u5f0f\u96c6\u6210](1.1-java)\n\n### [1.2 Spring \u96c6\u6210](1.2-spring)\n\n### [1.3 Spring Boot \u96c6\u6210](1.3-spring-boot)\n\n\n\n"},{"id":"37c5bcd","pId":0,"name":"2.orm","parent":"","sort_id":208200,"order":0,"extname":null,"open":true},{"id":"2.1-simple","pId":"37c5bcd","name":"2.1-simple","parent":"2.orm","order":0,"sort_id":208201,"extname":".md","isHidden":false,"content":"### 2.1 \u7b80\u5355\u793a\u4f8b\n\n\u793a\u4f8b\u9488\u5bf9 MySql \u6570\u636e\u5e93\uff08\u6570\u636e\u5e93\u5bf9\u4e3b\u952e\u5f71\u54cd\u8f83\u5927\uff0c\u548c insert \u5173\u7cfb\u5bc6\u5207\uff09\u3002\n\n\u6570\u636e\u5e93\u6709\u5982\u4e0b\u8868\uff1a\n\n```sql\nCREATE TABLE `country` (\n  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '\u4e3b\u952e',\n  `countryname` varchar(255) DEFAULT NULL COMMENT '\u540d\u79f0',\n  `countrycode` varchar(255) DEFAULT NULL COMMENT '\u4ee3\u7801',\n  PRIMARY KEY (`Id`)\n) ENGINE=InnoDB AUTO_INCREMENT=10011 DEFAULT CHARSET=utf8 COMMENT='\u56fd\u5bb6\u4fe1\u606f';\n```\n\n\u5bf9\u5e94\u7684 Java \u5b9e\u4f53\u7c7b\u578b\u5982\u4e0b\uff1a\n\n```java\npublic class Country {\n    @Id\n    private Integer id;\n    private String  countryname;\n    private String  countrycode;\n\n    //\u7701\u7565 getter \u548c setter\n}\n```\n\n\u6700\u7b80\u5355\u7684\u60c5\u51b5\u4e0b\uff0c\u53ea\u9700\u8981\u4e00\u4e2a `@Id` \u6807\u8bb0\u5b57\u6bb5\u4e3a\u4e3b\u952e\u5373\u53ef\u3002\u6570\u636e\u5e93\u4e2d\u7684\u5b57\u6bb5\u540d\u548c\u5b9e\u4f53\u7c7b\u7684\u5b57\u6bb5\u540d\u662f\u5b8c\u5168\u76f8\u540c\u7684\uff0c\u8fd9\u4e2d\u60c5\u51b5\u4e0b\u5b9e\u4f53\u548c\u8868\u53ef\u4ee5\u76f4\u63a5\u6620\u5c04\u3002\n\n**\u63d0\u9192\uff1a\u5982\u679c\u5b9e\u4f53\u7c7b\u4e2d\u6ca1\u6709\u4e00\u4e2a\u6807\u8bb0 `@Id` \u7684\u5b57\u6bb5\uff0c\u5f53\u4f60\u4f7f\u7528\u5e26\u6709 `ByPrimaryKey` \u7684\u65b9\u6cd5\u65f6\uff0c\u6240\u6709\u7684\u5b57\u6bb5\u4f1a\u4f5c\u4e3a\u8054\u5408\u4e3b\u952e\u6765\u4f7f\u7528\uff0c\u4e5f\u5c31\u4f1a\u51fa\u73b0\u7c7b\u4f3c `where id = ? and countryname = ? and countrycode = ?` \u7684\u60c5\u51b5\u3002**\n\n\u003E   \u7b2c\u56db\u7ae0\u4f1a\u4ecb\u7ecd\u4ee3\u7801\u751f\u6210\u5668\uff0c\u53ef\u4ee5\u81ea\u52a8\u751f\u6210\u4e0a\u9762\u7684\u5b9e\u4f53\u548c\u4e0b\u9762\u7684\u63a5\u53e3\u4ee3\u7801\n\n**\u901a\u7528 Mapper \u63d0\u4f9b\u4e86\u5927\u91cf\u7684\u901a\u7528\u63a5\u53e3\uff0c\u8fd9\u91cc\u4ee5\u6700\u5e38\u7528\u7684 Mapper \u63a5\u53e3\u4e3a\u4f8b**\n\n\u8be5\u5b9e\u4f53\u7c7b\u5bf9\u5e94\u7684\u6570\u636e\u5e93\u64cd\u4f5c\u63a5\u53e3\u5982\u4e0b\uff1a\n\n```java\nimport tk.mybatis.mapper.common.Mapper;\n\npublic interface CountryMapper extends Mapper\u003CCountry\u003E {\n}\n```\n\n\u003E   \u53ea\u8981\u914d\u7f6e MyBatis \u65f6\u80fd\u6ce8\u518c\u6216\u8005\u626b\u63cf\u5230\u8be5\u63a5\u53e3\uff0c\u8be5\u63a5\u53e3\u63d0\u4f9b\u7684\u65b9\u6cd5\u5c31\u90fd\u53ef\u4ee5\u4f7f\u7528\u3002\n\n\u8be5\u63a5\u53e3\u9ed8\u8ba4\u7ee7\u627f\u7684\u65b9\u6cd5\u5982\u4e0b\uff1a\n\n- *selectOne*\n- *select*\n- *selectAll*\n- *selectCount*\n- *selectByPrimaryKey*\n- *\u65b9\u6cd5\u592a\u591a\uff0c\u7701\u7565\u5176\u4ed6...*\n\n\u4ece MyBatis \u4e2d\u83b7\u53d6\u8be5\u63a5\u53e3\u540e\u5c31\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\uff1a\n\n```java\n//\u4ece MyBatis \u6216\u8005 Spring \u4e2d\u83b7\u53d6 countryMapper\uff0c\u7136\u540e\u8c03\u7528 selectAll \u65b9\u6cd5\nList\u003CCountry\u003E countries = countryMapper.selectAll();\n//\u6839\u636e\u4e3b\u952e\u67e5\u8be2\nCountry country = countryMapper.selectByPrimaryKey(1);\n//\u6216\u8005\u4f7f\u7528\u5bf9\u8c61\u4f20\u53c2\uff0c\u9002\u7528\u4e8e1\u4e2a\u5b57\u6bb5\u6216\u8005\u591a\u4e2a\u5b57\u6bb5\u8054\u5408\u4e3b\u952e\u4f7f\u7528\nCountry query = new Country();\nquery.setId(1);\ncountry = countryMapper.selectByPrimaryKey(query);\n```\n\n**\u5982\u679c\u60f3\u8981\u589e\u52a0\u81ea\u5df1\u5199\u7684\u65b9\u6cd5\uff0c\u53ef\u4ee5\u76f4\u63a5\u5728 `CountryMapper` \u4e2d\u589e\u52a0\u3002**\n\n**1. \u4f7f\u7528\u7eaf\u63a5\u53e3\u6ce8\u89e3\u65b9\u5f0f\u65f6**\n\n```java\nimport org.apache.ibatis.annotations.Select;\nimport tk.mybatis.mapper.common.Mapper;\n\npublic interface CountryMapper extends Mapper\u003CCountry\u003E {\n    @Select(\"select * from country where countryname = #{countryname}\")\n    Country selectByCountryName(String countryname);\n}\n```\n\n\u003E   \u8fd9\u91cc\u53ea\u662f\u4e3e\u4e86\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\uff0c\u53ef\u4ee5\u662f\u5f88\u590d\u6742\u7684\u67e5\u8be2\u3002\n\n**2. \u5982\u679c\u4f7f\u7528 XML \u65b9\u5f0f\uff0c\u9700\u8981\u63d0\u4f9b\u63a5\u53e3\u5bf9\u5e94\u7684 XML \u6587\u4ef6**\n\n\u4f8b\u5982\u63d0\u4f9b\u4e86 `CountryMapper.xml` \u6587\u4ef6\uff0c\u5185\u5bb9\u5982\u4e0b\uff1a\n\n```xml\n\u003C!DOCTYPE mapper\n        PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\"\n        \"http://mybatis.org/dtd/mybatis-3-mapper.dtd\"\u003E\n\u003Cmapper namespace=\"tk.mybatis.sample.mapper.CountryMapper\"\u003E\n    \u003Cselect id=\"selectByCountryName\" resultType=\"tk.mybatis.model.Country\"\u003E\n        select * from country where countryname = #{countryname}\n    \u003C/select\u003E\n\u003C/mapper\u003E\n```\n\n\u5728\u63a5\u53e3\u4e2d\u6dfb\u52a0\u5bf9\u5e94\u7684\u65b9\u6cd5\uff1a\n\n```java\nimport tk.mybatis.mapper.common.Mapper;\n\npublic interface CountryMapper extends Mapper\u003CCountry\u003E {\n    Country selectByCountryName(String countryname);\n}\n```\n\n\u5728\u63a5\u53e3\u4e2d\u6dfb\u52a0\u5176\u4ed6\u65b9\u6cd5\u7684\u65f6\u5019\u548c\u53ea\u7528 MyBatis \u662f\u5b8c\u5168\u4e00\u6837\u7684\uff0c**\u4f46\u662f\u9700\u8981\u6ce8\u610f\uff0c\u5728\u5bf9\u5e94\u7684 XML \u4e2d\uff0c\u4e0d\u80fd\u51fa\u73b0\u548c\u7ee7\u627f\u63a5\u53e3\u4e2d\u540c\u540d\u7684\u65b9\u6cd5\uff01**\n\n\u003E   **\u591a\u6001\uff01**\n\u003E\n\u003E   \u5728\u63a5\u53e3\u4e2d\uff0c\u53ea\u8981\u4e0d\u662f\u901a\u8fc7\u6ce8\u89e3\u6765\u5b9e\u73b0\u63a5\u53e3\u65b9\u6cd5\uff0c\u63a5\u53e3\u662f\u5141\u8bb8\u91cd\u540d\u7684\uff0c\u771f\u6b63\u8c03\u7528\u4f1a\u4f7f\u7528\u901a\u7528 Mapper \u63d0\u4f9b\u7684\u65b9\u6cd5\u3002\n\u003E\n\u003E   \u4f8b\u5982\u5728\u4e0a\u9762 CountryMapper \u4e2d\u63d0\u4f9b\u4e00\u4e2a\u5e26\u5206\u9875\u7684 selectAll \u65b9\u6cd5\uff1a\n\u003E\n\u003E   ```java\n\u003E   public interface CountryMapper extends Mapper\u003CCountry\u003E {\n\u003E       List\u003CCountry\u003E selectAll(RowBounds rowBounds);\n\u003E   }\n\u003E   ```\n\u003E\n\u003E   \u5728 Java 8 \u7684\u63a5\u53e3\u4e2d\u901a\u8fc7\u9ed8\u8ba4\u65b9\u6cd5\u8fd8\u80fd\u589e\u52a0\u4e00\u4e9b\u7b80\u5355\u7684\u95f4\u63a5\u8c03\u7528\u65b9\u6cd5\uff0c\u4f8b\u5982\uff1a\n\u003E\n\u003E   ```java\n\u003E   public interface CountryMapper extends Mapper\u003CCountry\u003E {\n\u003E       //\u8fd9\u4e2a\u793a\u4f8b\u9002\u5408\u53c2\u8003\u5b9e\u73b0\u5bf9\u4e50\u89c2\u9501\u65b9\u6cd5\u5c01\u88c5\n\u003E       default void updateSuccess(Country country){\n\u003E           Assert.assertEquals(1, updateByPrimaryKey(country));\n\u003E       }\n\u003E   }\n\u003E   ```\n\u003E\n\u003E   **\u5728\u4e0d\u719f\u6089 Java \u8bed\u8a00\u548c MyBatis \u7279\u6027\u524d\uff0c\u4e0d\u8981\u8f7b\u6613\u4f7f\u7528\uff01**\n\n"},{"id":"2.2-mapping","pId":"37c5bcd","name":"2.2-mapping","parent":"2.orm","order":0,"sort_id":208202,"extname":".md","isHidden":false,"content":"### 2.2 \u6570\u636e\u5e93\u6620\u5c04\n\n\u5728 2.1 \u4e2d\u770b\u5230\u7684\u662f\u6700\u7b80\u5355\u7684\u60c5\u51b5\uff0c\u5b9e\u9645\u4f7f\u7528\u8fc7\u7a0b\u4e2d\u4e5f\u4e0d\u4f1a\u66f4\u590d\u6742\uff0c\u4e0b\u9762\u662f\u66f4\u8be6\u7ec6\u7684\u6620\u5c04\u914d\u7f6e\u3002\n\n**\u901a\u7528 Mapper \u4e2d\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u662f\u5c06\u5b9e\u4f53\u7c7b\u5b57\u6bb5\u6309\u7167\u9a7c\u5cf0\u8f6c\u4e0b\u5212\u7ebf\u5f62\u5f0f\u7684\u8868\u540d\u5217\u540d\u8fdb\u884c\u8f6c\u6362\u3002**\n\n\u003E   \u4f8b\u5982 \n\u003E\n\u003E   \u5b9e\u4f53\u7c7b\u7684 `userName` \u53ef\u4ee5\u6620\u5c04\u5230\u8868\u7684 `user_name` \u4e0a\u3002\n\u003E\n\u003E   \u5982\u679c\u60f3\u8981\u4fee\u6539\u9ed8\u8ba4\u7684\u8f6c\u6362\u65b9\u5f0f\uff0c\u53ef\u4ee5\u5728\u540e\u7eed\u7684\u914d\u7f6e\u4e2d\uff0c\u4fee\u6539 `style` \u5168\u5c40\u914d\u7f6e\u3002\n\n\u6570\u636e\u5e93\u6620\u5c04\u4e3b\u8981\u6d89\u53ca\u5230\u4e00\u4e9b\u6ce8\u89e3\u548c\u5168\u5c40\u914d\u7f6e\uff0c\u8fd9\u4e00\u8282\u4e2d\u4f1a\u4ecb\u7ecd\u6240\u6709\u6ce8\u89e3\uff0c\u540e\u9762\u7ae0\u8282\u4f1a\u6709\u914d\u7f6e\u7684\u4ecb\u7ecd\u3002\n\n\u901a\u7528 Mapper \u9ed8\u8ba4\u4f7f\u7528\u4e86\u51e0\u4e2a\u7b80\u5355\u7684\u6ce8\u89e3\uff0c\u5176\u4ed6 JPA \u7684\u6ce8\u89e3\u9ed8\u8ba4\u5e76\u4e0d\u652f\u6301\uff0c\u4f46\u662f\u5982\u679c\u4f60\u5f00\u53d1\u81ea\u5df1\u7684\u901a\u7528\u65b9\u6cd5\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528 JPA \u6ce8\u89e3\u6216\u8005\u5f15\u5165\u81ea\u5df1\u7684\u6ce8\u89e3\u3002\n\n#### 2.2.1`@NameStyle` \u6ce8\u89e3\uff08Mapper\uff09\n\n\u8fd9\u4e2a\u6ce8\u89e3\u53ef\u4ee5\u5728\u7c7b\u4e0a\u8fdb\u884c\u914d\u7f6e\uff0c\u4f18\u5148\u7ea7\u9ad8\u4e8e\u5bf9\u5e94\u7684 `style` \u5168\u5c40\u914d\u7f6e\u3002\n\n\u6ce8\u89e3\u652f\u6301\u4ee5\u4e0b\u51e0\u4e2a\u9009\u9879\uff1a\n\n```\nnormal,                     //\u539f\u503c\ncamelhump,                  //\u9a7c\u5cf0\u8f6c\u4e0b\u5212\u7ebf\nuppercase,                  //\u8f6c\u6362\u4e3a\u5927\u5199\nlowercase,                  //\u8f6c\u6362\u4e3a\u5c0f\u5199\ncamelhumpAndUppercase,      //\u9a7c\u5cf0\u8f6c\u4e0b\u5212\u7ebf\u5927\u5199\u5f62\u5f0f\ncamelhumpAndLowercase,      //\u9a7c\u5cf0\u8f6c\u4e0b\u5212\u7ebf\u5c0f\u5199\u5f62\u5f0f\n```\n\n\u4f7f\u7528\u65f6\uff0c\u76f4\u63a5\u5728\u7c7b\u4e0a\u914d\u7f6e\u5373\u53ef\uff0c\u4f8b\u5982\uff1a\n\n```java\n@NameStyle(Style.camelhumpAndUppercase)\npublic class Country\n```\n\n\u914d\u7f6e\u8be5\u6ce8\u89e3\u540e\uff0c\u5bf9\u8be5\u7c7b\u548c\u5176\u4e2d\u7684\u5b57\u6bb5\u8fdb\u884c\u8f6c\u6362\u65f6\uff0c\u4f1a\u5c06\u5f62\u5982 `userName` \u7684\u5b57\u6bb5\u8f6c\u6362\u4e3a\u8868\u4e2d\u7684 `USER_NAME` \u5b57\u6bb5\u3002\n\n#### 2.2.2 `@Table` \u6ce8\u89e3\uff08JPA\uff09\n\n`@Table` \u6ce8\u89e3\u53ef\u4ee5\u914d\u7f6e `name`,`catalog` \u548c `schema` \u4e09\u4e2a\u5c5e\u6027\uff0c\u914d\u7f6e `name` \u5c5e\u6027\u540e\uff0c\u76f4\u63a5\u4f7f\u7528\u63d0\u4f9b\u7684\u8868\u540d\uff0c\u4e0d\u518d\u6839\u636e\u5b9e\u4f53\u7c7b\u540d\u8fdb\u884c\u8f6c\u6362\u3002\u5176\u4ed6\u4e24\u4e2a\u5c5e\u6027\u4e2d\uff0c\u540c\u65f6\u914d\u7f6e\u65f6\uff0c`catalog` \u4f18\u5148\u7ea7\u9ad8\u4e8e `schema`\uff0c\u4e5f\u5c31\u662f\u53ea\u6709 `catalog` \u4f1a\u751f\u6548\u3002\n\n\u914d\u7f6e\u793a\u4f8b\u5982\u4e0b\uff1a\n\n```java\n@Table(name = \"sys_user\")\npublic class User\n```\n\n\u5c06 `User` \u5b9e\u4f53\u6620\u5c04\u5230 `sys_user` \u8868\u3002\n\n#### 2.2.3 `@Column` \u6ce8\u89e3\uff08JPA\uff09\n\n`@Column` \u6ce8\u89e3\u652f\u6301 `name`, `insertable` \u548c `updateable` \u4e09\u4e2a\u5c5e\u6027\u3002\n\n`name` \u914d\u7f6e\u6620\u5c04\u7684\u5217\u540d\u3002\n\n`insertable` \u5bf9\u63d0\u4f9b\u7684 `insert` \u65b9\u6cd5\u6709\u6548\uff0c\u5982\u679c\u8bbe\u7f6e `false` \u5c31\u4e0d\u4f1a\u51fa\u73b0\u5728 SQL \u4e2d\u3002\n\n`updateable` \u5bf9\u63d0\u4f9b\u7684 `update` \u65b9\u6cd5\u6709\u6548\uff0c\u8bbe\u7f6e\u4e3a `false` \u540e\u4e0d\u4f1a\u51fa\u73b0\u5728 SQL \u4e2d\u3002\n\n\u914d\u7f6e\u793a\u4f8b\u5982\uff1a\n\n```java\n@Column(name = \"user_name\")\nprivate String name;\n```\n\n\u9664\u4e86\u76f4\u63a5\u6620\u5c04 `name` \u5230 `user_name` \u8fd9\u79cd\u7528\u6cd5\u5916\uff0c\u5728\u4f7f\u7528\u5173\u952e\u5b57\u7684\u60c5\u51b5\uff0c\u8fd8\u4f1a\u6709\u4e0b\u9762\u7684\u7528\u6cd5\uff1a\n\n```java\n@Column(name = \"`order`\")\nprivate String order;\n```\n\n\u5bf9\u4e8e\u5173\u952e\u5b57\u8fd9\u79cd\u60c5\u51b5\uff0c\u901a\u7528 Mapper \u652f\u6301\u81ea\u52a8\u8f6c\u6362\uff0c\u53ef\u4ee5\u67e5\u770b\u540e\u7eed\u914d\u7f6e\u6587\u6863\u4e2d\u7684 **wrapKeyword** \u914d\u7f6e\u3002\n\n#### 2.2.4 `@ColumnType` \u6ce8\u89e3\uff08Mapper\uff09\n\n\u8fd9\u4e2a\u6ce8\u89e3\u63d0\u4f9b\u7684 `column`\u5c5e\u6027\u548c `@Column` \u4e2d\u7684 `name` \u4f5c\u7528\u76f8\u540c\u3002\u4f46\u662f `@Column` \u7684\u4f18\u5148\u7ea7\u66f4\u9ad8\u3002\n\n\u9664\u4e86 `name` \u5c5e\u6027\u5916\uff0c\u8fd9\u4e2a\u6ce8\u89e3\u4e3b\u8981\u63d0\u4f9b\u4e86  `jdbcType` \u5c5e\u6027\u548c `typeHandler` \u5c5e\u6027\u3002\n\n`jdbcType` \u7528\u4e8e\u8bbe\u7f6e\u7279\u6b8a\u6570\u636e\u5e93\u7c7b\u578b\u65f6\u6307\u5b9a\u6570\u636e\u5e93\u4e2d\u7684 `jdbcType`\u3002\n\n`typeHandler` \u7528\u4e8e\u8bbe\u7f6e\u7279\u6b8a\u7c7b\u578b\u5904\u7406\u5668\uff0c\u5e38\u89c1\u7684\u662f\u679a\u4e3e\u3002\n\n\u7528\u6cd5\u793a\u4f8b\u5982\u4e0b\uff1a\n\n```java\n@ColumnType(\n        column = \"countryname\",\n        jdbcType = JdbcType.VARCHAR,\n        typeHandler = StringTypeHandler.class)\nprivate String  countryname;\n```\n\n#### 2.2.5 `@Transient` \u6ce8\u89e3\uff08JPA\uff09 \n\n\u4e00\u822c\u60c5\u51b5\u4e0b\uff0c\u5b9e\u4f53\u4e2d\u7684\u5b57\u6bb5\u548c\u6570\u636e\u5e93\u8868\u4e2d\u7684\u5b57\u6bb5\u662f\u4e00\u4e00\u5bf9\u5e94\u7684\uff0c\u4f46\u662f\u4e5f\u6709\u5f88\u591a\u60c5\u51b5\u6211\u4eec\u4f1a\u5728\u5b9e\u4f53\u4e2d\u589e\u52a0\u4e00\u4e9b\u989d\u5916\u7684\u5c5e\u6027\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u5c31\u9700\u8981\u4f7f\u7528  `@Transient` \u6ce8\u89e3\u6765\u544a\u8bc9\u901a\u7528 Mapper \u8fd9\u4e0d\u662f\u8868\u4e2d\u7684\u5b57\u6bb5\u3002\n\n\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u6709\u7b80\u5355\u7c7b\u578b\u4f1a\u88ab\u81ea\u52a8\u8ba4\u4e3a\u662f\u8868\u4e2d\u7684\u5b57\u6bb5\uff08\u53ef\u4ee5\u901a\u8fc7\u914d\u7f6e\u4e2d\u7684 **`useSimpleType`** \u63a7\u5236\uff09\u3002\n\n\u003E   \u8fd9\u91cc\u7684\u7b80\u5355\u7c7b\u578b\u4e0d\u5305\u542b Java \u4e2d\u76848\u79cd\u57fa\u672c\u7c7b\u578b\uff1a\n\u003E\n\u003E   byte,short,int,long,float,double,char,boolean\n\u003E\n\u003E   \u8fd9\u662f\u56e0\u4e3a\u5728\u7c7b\u4e2d\uff0c\u57fa\u672c\u7c7b\u578b\u4f1a\u6709\u9ed8\u8ba4\u503c\uff0c\u800c MyBatis \u4e2d\u7ecf\u5e38\u4f1a\u9700\u8981\u5224\u65ad\u5c5e\u6027\u503c\u662f\u5426\u4e3a\u7a7a\uff0c\u6240\u4ee5\u4e0d\u8981\u5728\u7c7b\u4e2d\u4f7f\u7528\u57fa\u672c\u7c7b\u578b\uff0c\u5426\u5219\u4f1a\u9047\u5230\u83ab\u540d\u5176\u5999\u7684\u9519\u8bef\u3002\n\n\u5bf9\u4e8e\u7c7b\u4e2d\u7684\u590d\u6742\u5bf9\u8c61\uff0c\u4ee5\u53ca `Map`,`List` \u7b49\u5c5e\u6027\u4e0d\u9700\u8981\u914d\u7f6e\u8fd9\u4e2a\u6ce8\u89e3\u3002\n\n\u5bf9\u4e8e\u679a\u4e3e\u7c7b\u578b\u4f5c\u4e3a\u6570\u636e\u5e93\u5b57\u6bb5\u7684\u60c5\u51b5\uff0c\u9700\u8981\u770b\u914d\u7f6e\u4e2d\u7684 **`enumAsSimpleType`** \u53c2\u6570\u3002\n\n\u914d\u7f6e\u793a\u4f8b\uff1a\n\n```java\n@Transient\nprivate String otherThings; //\u975e\u6570\u636e\u5e93\u8868\u4e2d\u5b57\u6bb5\n```\n\n#### 2.2.6 `@Id` \u6ce8\u89e3\uff08JPA\uff09\n\n\u4e0a\u9762\u51e0\u4e2a\u6ce8\u89e3\u90fd\u6d89\u53ca\u5230\u6620\u5c04\u3002 `@Id` \u6ce8\u89e3\u548c\u6620\u5c04\u65e0\u5173\uff0c\u5b83\u662f\u4e00\u4e2a\u7279\u6b8a\u7684\u6807\u8bb0\uff0c\u7528\u4e8e\u6807\u8bc6\u6570\u636e\u5e93\u4e2d\u7684\u4e3b\u952e\u5b57\u6bb5\u3002\n\n\u6b63\u5e38\u60c5\u51b5\u4e0b\uff0c**\u4e00\u4e2a\u5b9e\u4f53\u7c7b\u4e2d\u81f3\u5c11\u9700\u8981\u4e00\u4e2a\u6807\u8bb0 `@Id` \u6ce8\u89e3\u7684\u5b57\u6bb5\uff0c\u5b58\u5728\u8054\u5408\u4e3b\u952e\u65f6\u53ef\u4ee5\u6807\u8bb0\u591a\u4e2a\u3002**\n\n\u5982\u679c\u8868\u4e2d\u6ca1\u6709\u4e3b\u952e\uff0c\u7c7b\u4e2d\u5c31\u53ef\u4ee5\u4e0d\u6807\u8bb0\u3002\n\n\u5f53\u7c7b\u4e2d\u6ca1\u6709\u5b58\u5728\u6807\u8bb0 `@Id` \u6ce8\u89e3\u7684\u5b57\u6bb5\u65f6\uff0c\u4f60\u53ef\u4ee5\u7406\u89e3\u4e3a\u7c7b\u4e2d\u7684**\u6240\u6709\u5b57\u6bb5\u662f\u8054\u5408\u4e3b\u952e**\u3002\u4f7f\u7528\u6240\u6709\u7684 `ByPrimaryKey` \u76f8\u5173\u7684\u65b9\u6cd5\u65f6\uff0c\u6709 `where` \u6761\u4ef6\u7684\u5730\u65b9\uff0c\u4f1a\u5c06\u6240\u6709\u5217\u4f5c\u4e3a\u6761\u4ef6\u3002\n\n\u914d\u7f6e\u793a\u4f8b\uff1a\n\n```java\n@Id\nprivate Integer id;\n```\n\n\u6216\u8005\u8054\u5408\u4e3b\u952e\uff1a\n\n```java\n@Id\nprivate Integer userId;\n@Id\nprivate Integer roleId;\n```\n\n#### 2.2.7 `@GeneratedValue` \u6ce8\u89e3\uff08JPA\uff09\n\n\u4e3b\u952e\u7b56\u7565\u6ce8\u89e3\uff0c\u7528\u4e8e\u914d\u7f6e\u5982\u4f55\u751f\u6210\u4e3b\u952e\u3002\n\n\u7531\u4e8e\u4e0d\u540c\u7c7b\u578b\u6570\u636e\u5e93\u7684\u914d\u7f6e\u4e0d\u540c\uff0c\u6240\u4ee5\u540e\u9762\u6709\u4e00\u8282\u4e13\u95e8\u4ecb\u7ecd\u8be5\u6ce8\u89e3\u7684\u6587\u6863\u3002\n\n\u5173\u4e8e\u8be5\u6ce8\u89e3\u7684\u7528\u6cd5\u53ef\u4ee5\u67e5\u770b **2.3 \u4e3b\u952e\u7b56\u7565**\u3002\n\n\n#### 2.2.8 `@Version` \u6ce8\u89e3\uff08Mapper\uff09\n\n `@Version` \u662f\u5b9e\u73b0\u4e50\u89c2\u9501\u7684\u4e00\u4e2a\u6ce8\u89e3\uff0c\u5927\u591a\u6570\u4eba\u90fd\u4e0d\u9700\u8981\u3002\n\n\u9700\u8981\u4f7f\u7528\u8be5\u6ce8\u89e3\u7684\u8bf7\u770b **2.4 \u4e50\u89c2\u9501**\u3002\n\n#### 2.2.9 `@RegisterMapper` \u6ce8\u89e3\n\n\u4e3a\u4e86\u89e3\u51b3\u901a\u7528 Mapper \u4e2d\u6700\u5e38\u89c1\u7684\u4e00\u4e2a\u9519\u8bef\u800c\u589e\u52a0\u7684\u6807\u8bb0\u6ce8\u89e3\uff0c\u8be5\u6ce8\u89e3\u4ec5\u7528\u4e8e\u5f00\u53d1\u7684\u901a\u7528\u63a5\u53e3\uff0c\u4e0d\u662f\u5b9e\u4f53\u7c7b\u4e0a\u4f7f\u7528\u7684\uff0c\u8fd9\u91cc\u548c\u5176\u4ed6\u6ce8\u89e3\u4e00\u8d77\u4ecb\u7ecd\u4e86\u3002\n\n4.0 \u7248\u672c\u63d0\u4f9b\u7684\u6240\u6709\u901a\u7528\u63a5\u53e3\u4e0a\u90fd\u6807\u8bb0\u4e86\u8be5\u6ce8\u89e3\uff0c\u56e0\u6b64\u81ea\u5e26\u7684\u901a\u7528\u63a5\u53e3\u65f6\uff0c\u4e0d\u9700\u8981\u914d\u7f6e `mappers` \u53c2\u6570\uff0c\u8be5\u6ce8\u89e3\u7684\u5177\u4f53\u7528\u6cd5\u4f1a\u5728 **\u7b2c\u4e94\u7ae0 \u6269\u5c55\u901a\u7528\u63a5\u53e3** \u4e2d\u4ecb\u7ecd\u3002\n\n#### 2.2.10 \u81ea\u5b9a\u4e49\u6ce8\u89e3\n\n*\u8fd9\u90e8\u5206\u63d0\u4f9b\u7ed9\u60f3\u8981\u5f00\u53d1\u901a\u7528\u65b9\u6cd5\u7684\u670b\u53cb\uff0c\u5982\u679c\u53ea\u662f\u4f7f\u7528\uff0c\u4e0d\u9700\u8981\u9605\u8bfb\u8fd9\u90e8\u5206\u5185\u5bb9\u3002*\n\n\u5728\u901a\u7528 Mapper \u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7 `EntityHelper.getColumns(entityClass)` \u65b9\u6cd5\u6765\u83b7\u53d6\u5b9e\u4f53\u7c7b\u7684\u5168\u90e8\u4fe1\u606f\u3002\n\n\u5728 `EntityColumn` \u4e2d\uff0c\u901a\u8fc7\u4e0b\u9762\u7684\u4ee3\u7801\u53ef\u4ee5\u83b7\u53d6\u5b57\u6bb5\u4e0a\u7684\u4efb\u610f\u6ce8\u89e3\u3002\n\n```java\n//\u5224\u65ad\u662f\u5426\u6709\u67d0\u4e2a\u6ce8\u89e3\nboolean hasVersion = column.getEntityField().isAnnotationPresent(Version.class)\n//\u901a\u8fc7\u4e0b\u9762\u7684\u4ee3\u7801\u53ef\u4ee5\u83b7\u53d6\u6ce8\u89e3\u4fe1\u606f\nVersion version = column.getEntityField().getAnnotation(Version.class);\n```\n\n\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u5728\u5b9e\u73b0\u81ea\u5df1\u7684\u901a\u7528\u65b9\u5f0f\u65f6\uff0c\u53ef\u4ee5\u6839\u636e\u9700\u8981\u6765\u589e\u52a0\u989d\u5916\u7684\u6ce8\u89e3\u6765\u5b9e\u73b0\u4e00\u4e9b\u5176\u4ed6\u7684\u7528\u9014\u3002"},{"id":"2.3-generatedvalue","pId":"37c5bcd","name":"2.3-generatedvalue","parent":"2.orm","order":0,"sort_id":208203,"extname":".md","isHidden":false,"content":"### 2.3 \u4e3b\u952e\u7b56\u7565\n\n\u5728 2.2 \u4e2d\u4ecb\u7ecd\u4e86\u6240\u6709\u5176\u4ed6\u6ce8\u89e3\u7684\u4f5c\u7528\u548c\u7528\u6cd5\uff0c\u7531\u4e8e\u4e3b\u952e\u7b56\u7565\u6bd4\u8f83\u590d\u6742\uff0c\u5355\u72ec\u7528\u4e00\u8282\u6765\u9610\u8ff0\u3002\n\n\u9996\u5148\u4e3b\u952e\u7b56\u7565\u548c\u6570\u636e\u5e93\u5173\u7cfb\u5f88\u5927\uff0c\u6709\u4e9b\u6570\u636e\u5e93\u652f\u6301\u4e3b\u952e\u81ea\u589e\uff0c\u800c\u6709\u4e9b\u6570\u636e\u5e93\u53ea\u80fd\u901a\u8fc7\u5e8f\u5217\u6765\u83b7\u5f97\u3002\n\n#### 2.3.1 JDBC \u652f\u6301\u901a\u8fc7 `getGeneratedKeys` \u65b9\u6cd5\u53d6\u56de\u4e3b\u952e\u7684\u60c5\u51b5\n\n\u8fd9\u79cd\u60c5\u51b5\u9996\u5148\u9700\u8981\u6570\u636e\u5e93\u652f\u6301\u81ea\u589e\uff0c\u5176\u6b21\u6570\u636e\u5e93\u63d0\u4f9b\u7684 JDBC \u652f\u6301 `getGeneratedKeys` \u65b9\u6cd5\u3002\n\n\u5e38\u89c1\u7684\u5982 MySql\uff0cSqlServer \u652f\u6301\u8fd9\u79cd\u6a21\u5f0f\u3002\n\n\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u914d\u7f6e\u4e3b\u952e\u7b56\u7565\u6700\u7b80\u5355\u3002\n\n\u7528\u6cd5\u5982\u4e0b\uff1a\n\n```java\n@Id\n@GeneratedValue(generator = \"JDBC\")\nprivate Long id;\n```\n\n\u4e3a\u4e86\u8ba9\u5927\u5bb6\u5bb9\u6613\u7406\u89e3\u8fd9\u91cc\u914d\u7f6e\u548c MyBatis \u5199\u6cd5\u7684\u5173\u7cfb\uff0c\u5927\u5bb6\u53ef\u4ee5\u770b\u770b\u5bf9\u5e94\u751f\u6210\u7684 XML \u4ee3\u7801\uff1a\n\n```xml\n\u003Cinsert id=\"insert\" useGeneratedKeys=\"true\" keyProperty=\"id\"\u003E\n    insert into country (id, countryname, countrycode)\n    values (#{id},#{countryname},#{countrycode})\n\u003C/insert\u003E\n```\n\n\u003E   SqlServer \u4e2d\u4f7f\u7528\u65f6\uff0c\u9700\u8981\u8bbe\u7f6e id \u7684 `insertable=false` \n\n#### 2.3.2 \u652f\u6301\u81ea\u589e\u7684\u6570\u636e\u5e93\n\n\u652f\u6301\u81ea\u589e\u7684\u6570\u636e\u5e93\u5217\u8868\u5982\u4e0b\uff1a\n\n- **DB2**: `VALUES IDENTITY_VAL_LOCAL()`\n- **MYSQL**: `SELECT LAST_INSERT_ID()`\n- **SQLSERVER**: `SELECT SCOPE_IDENTITY()`\n- **CLOUDSCAPE**: `VALUES IDENTITY_VAL_LOCAL()`\n- **DERBY**: `VALUES IDENTITY_VAL_LOCAL()`\n- **HSQLDB**: `CALL IDENTITY()`\n- **SYBASE**: `SELECT @@IDENTITY`\n- **DB2_MF**: `SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1`\n- **INFORMIX**: `select dbinfo('sqlca.sqlerrd1') from systables where tabid=1`\n\n\u003E   \u8fd9\u4e2a\u5217\u8868\u53ea\u662f\u5217\u4e3e\u4e86\u6bd4\u8f83\u5e38\u89c1\u7684\u6570\u636e\u5e93\uff0c\u5176\u4ed6\u7c7b\u4f3c\u7684\u4e5f\u652f\u6301\u3002\n\u003E\n\u003E   \u5217\u8868\u6570\u636e\u5e93\u540d\u5b57\u540e\u9762\u5bf9\u5e94\u7684 SQL \u662f\u63d2\u5165\u540e**\u53d6 id \u7684 SQL \u8bed\u53e5**\u3002\n\n\u8fd9\u7c7b\u6570\u636e\u5e93\u4e3b\u952e\u7b56\u7565\u914d\u7f6e\u793a\u4f8b\u5982\u4e0b\uff1a\n\n```java\n@Id\n@GeneratedValue(strategy = GenerationType.IDENTITY)\nprivate Integer id;\n```\n\n\u9664\u6b64\u4e4b\u5916\uff0c\u8fd9\u79cd\u7528\u6cd5\u8fd8\u8981\u914d\u5408 **IDENTITY** \u53c2\u6570\uff08\u4ee5\u53ca **ORDER** \u53c2\u6570\uff09\uff0c\u8fd9\u4e2a\u53c2\u6570\u503c\u9700\u8981\u914d\u7f6e\u4e3a\u5bf9\u5e94\u7684\u6570\u636e\u5e93\uff0c\u5c31\u662f\u4e0a\u9762\u5217\u8868\u4e2d\u7684\u540d\u5b57\uff0c\u5177\u4f53\u7684\u914d\u7f6e\u65b9\u6cd5\u770b\u540e\u9762\u7ae0\u8282\u7684\u5185\u5bb9\u3002\n\n\u8fd9\u79cd\u914d\u7f6e\u5bf9\u5e94\u7684 XML \u5f62\u5f0f\u4e3a\uff1a\n\n```xml\n\u003Cinsert id=\"insertAuthor\"\u003E\n    \u003CselectKey keyProperty=\"id\" resultType=\"int\" order=\"AFTER\"\u003E\n      SELECT LAST_INSERT_ID()\n    \u003C/selectKey\u003E\n    insert into country (id, countryname, countrycode)\n    values (#{id},#{countryname},#{countrycode})\n\u003C/insert\u003E\n```\n\n **IDENTITY** \u53c2\u6570\u4ee5\u53ca **ORDER** \u53c2\u6570\u4f1a\u51b3\u5b9a `selectKey` \u4e2d\u7684 SQL \u548c `order` \u5c5e\u6027\u7684\u503c\uff08\u8fd9\u91cc\u662f `AFTER`\uff09\u3002\n\n#### 2.3.3 \u901a\u8fc7\u5e8f\u5217\u548c\u4efb\u610f SQL \u83b7\u53d6\u4e3b\u952e\u503c\n\n\u50cf Oracle \u4e2d\u901a\u8fc7\u5e8f\u5217\u83b7\u53d6\u4e3b\u952e\u5c31\u5c5e\u4e8e\u8fd9\u79cd\u60c5\u51b5\uff0c\u5b9e\u9645\u4e0a 2.3.2 \u4e2d\u7684 SQL \u4e5f\u53ef\u4ee5\u5728\u8fd9\u91cc\u914d\u7f6e\u3002\n\n\u9664\u4e86\u7c7b\u4f3c\u5e8f\u5217\u83b7\u53d6\u503c\u5916\uff0c\u8fd8\u53ef\u4ee5\u662f\u83b7\u53d6 UUID \u7684 SQL \u8bed\u53e5\uff0c\u4f8b\u5982 `select uuid()`\u3002\n\n**2.3.3 \u548c 2.3.2 \u7684\u533a\u522b\u4e3b\u8981\u5728\u4e8e**\uff0c2.3.2 \u662f\u63d2\u5165\u8868\u4e4b\u540e\u624d\u6709 id \u7684\u503c\uff0c2.3.3 \u662f\u63d2\u5165\u6570\u636e\u5e93\u524d\u9700\u8981\u83b7\u53d6\u4e00\u4e2a\u503c\u4f5c\u4e3a\u4e3b\u952e\u3002\n\n\u5728 Oracle \u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u7528\u4e0b\u9762\u7684\u65b9\u5f0f\u8fdb\u884c\u914d\u7f6e\uff1a\n\n```java\n@Id\n@GeneratedValue(\n  strategy = GenerationType.IDENTITY,\n  generator = \"select SEQ_ID.nextval from dual\")\nprivate Integer id;\n```\n\n\u9664\u6b64\u4e4b\u5916\u4e5f\u8981\u914d\u7f6e\u4e00\u4e2a **ORDER** \u5168\u5c40\u53c2\u6570\uff0c2.3.2 \u4e2d\u63d0\u5230\u7684 `AFTER`\uff0c\u5728 2.3.3 \u4e2d\u9700\u8981\u914d\u7f6e\u4e3a `BEFORE`\uff0c\u5177\u4f53\u914d\u7f6e\u65b9\u5f0f\u770b\u540e\u9762\u7ae0\u8282\u7684\u5185\u5bb9\u3002\n\n\u8fd9\u79cd\u914d\u7f6e\u5bf9\u5e94\u7684 XML \u4ee3\u7801\u5982\u4e0b\uff1a\n\n```xml\n\u003Cinsert id=\"insertAuthor\"\u003E\n  \u003CselectKey keyProperty=\"id\" resultType=\"int\" order=\"BEFORE\"\u003E\n    select SEQ_ID.nextval from dual\n  \u003C/selectKey\u003E\n  insert into country (id, countryname, countrycode)\n  values (#{id},#{countryname},#{countrycode})\n\u003C/insert\u003E\n```\n\n\u003E   \u8fd9\u79cd\u7528\u6cd5\u4e2d\uff0c`values` \u4e2d\u5fc5\u987b\u51fa\u73b0\u4e3b\u952e\u7684\u503c\uff0c\u5426\u5219\u5c31\u63d2\u4e0d\u5230\u6570\u636e\u5e93\u3002\n\n\u9664\u4e86 Oracle \u8fd9\u79cd\u5916\uff0c\u8fd8\u6709\u4e00\u79cd\u66f4\u666e\u904d\u7684\u7528\u6cd5\uff0c\u5c31\u662f\u4f7f\u7528 UUID\u3002\n\n\u4f8b\u5982\u4e0b\u9762\u7684\u914d\u7f6e\uff1a\n\n```java\n@Id\n@GeneratedValue(strategy = GenerationType.IDENTITY,generator = \"select uuid()\")\nprivate String id;\n```\n\n\u003E   \u6ce8\u610f SQL \u8fd4\u56de\u503c\u7c7b\u578b\u548c\u8fd9\u91cc\u63a5\u6536\u7684\u7c7b\u578b\uff08`String`\uff09\u4e00\u81f4\u3002\n\n#### 2.3.4 TODO \u589e\u52a0\u4e00\u79cd\u65b0\u7684\u6ce8\u89e3\uff0c\u80fd\u591f\u72ec\u7acb\u914d\u7f6e SQL \u548c ORDER \n\n\u7531\u4e8e 2.3.2 \u548c 2.3.3 \u4e2d\u7684\u914d\u7f6e\u90fd\u4f9d\u8d56\u4e8e `ORDER`\uff0c\u5e76\u4e14\u8fd9\u4e24\u79cd\u60c5\u51b5\u4e0b\u7684\u503c\u76f8\u53cd\uff0c\u56e0\u6b64\u5982\u679c\u60f3\u8981\u540c\u65f6\u4f7f\u7528\u5c31\u4f1a\u51fa\u73b0\u95ee\u9898\uff0c\u56e0\u6b64\u63d0\u4f9b\u4e00\u4e2a\u65b0\u7684\u4e13\u7528\u6ce8\u89e3\u6765\u66ff\u4ee3 2.3.2 \u548c 2.3.3 \u662f\u5f88\u6709\u5fc5\u8981\u7684\u3002\n\n\u8fd9\u4e2a\u529f\u80fd\u5f85\u5b9a\uff0c\u51c6\u5907\u5305\u542b\u5728 4.0 \u7248\u672c\u4e2d\u3002\n\n\n\n"},{"id":"2.4-version","pId":"37c5bcd","name":"2.4-version","parent":"2.orm","order":0,"sort_id":208204,"extname":".md","isHidden":false,"content":"### 2.4 \u4e50\u89c2\u9501\n\n"},{"id":"2.orm","pId":"37c5bcd","name":"2.orm","parent":"2.orm","order":0,"sort_id":208205,"extname":".md","isHidden":false,"content":"## \u4e8c\u3001\u5bf9\u8c61\u5173\u7cfb\u6620\u5c04\n\n\u901a\u8fc7\u4e0a\u4e00\u7ae0\u7684\u6587\u6863\u96c6\u6210\u597d\u901a\u7528 Mapper \u540e\uff0c\u5c31\u53ef\u4ee5\u7ee7\u7eed\u770b\u8fd9\u91cc\u4e86\u3002\n\n\u901a\u7528 Mapper \u4f7f\u7528 JPA \u6ce8\u89e3\u548c\u81ea\u5df1\u63d0\u4f9b\u7684\u6ce8\u89e3\u6765\u5b9e\u73b0\u5bf9\u8c61\u5173\u7cfb\u6620\u5c04\uff0c\u7531\u4e8e\u672c\u7ae0\u5305\u542b\u4e86\u5f88\u591a\u7ec6\u8282\uff0c\u6240\u4ee5\u901a\u8fc7\u7b80\u5355\u7684\u793a\u4f8b\u5148\u5f15\u9886\u5165\u95e8\uff0c\u7136\u540e\u5728\u4e00\u6b65\u6b65\u6df1\u5165\u53bb\u770b\u8be6\u7ec6\u7684\u914d\u7f6e\u3002\n\n\u672c\u7ae0\u5305\u542b\u4e0b\u9762\u7684\u5185\u5bb9\uff0c\u8bf7\u6309\u7167\u987a\u5e8f\u9605\u8bfb\u3002\n\n### [2.1 \u7b80\u5355\u793a\u4f8b\uff08\u5fc5\u770b\uff09](2.1-simple)\n\n### [2.2 \u6570\u636e\u5e93\u6620\u5c04\uff08\u5fc5\u770b\uff09](2.2-mapping)\n\n### [2.3 \u4e3b\u952e\u7b56\u7565\uff08\u5fc5\u770b\uff09](2.3-generatedvalue)\n\n### [2.4 \u4e50\u89c2\u9501\uff08\u53ef\u9009\uff09](2.4-version)"},{"id":"5254214","pId":0,"name":"3.config","parent":"","sort_id":208206,"order":0,"extname":null,"open":true},{"id":"3.config","pId":"5254214","name":"3.config","parent":"3.config","order":0,"sort_id":208207,"extname":".md","isHidden":false,"content":"## \u4e09\u3001\u914d\u7f6e\u4ecb\u7ecd\n\n\u7531\u4e8e\u6570\u636e\u5e93\u5b58\u5728\u5404\u79cd\u5404\u6837\u7684\u5dee\u5f02\uff0c\u56e0\u6b64\u6709\u4e9b\u65f6\u5019\u8981\u505a\u4e00\u4e9b\u5fc5\u8981\u7684\u914d\u7f6e\u3002\n\n\u6b64\u5916\u901a\u7528 Mapper \u8fd8\u63d0\u4f9b\u4e86\u4e00\u4e9b\u63a7\u5236\u53c2\u6570\u548c\u4e00\u4e9b\u548c\u4e3b\u952e\u7b56\u7565\u76f8\u5173\u7684\u53c2\u6570\u3002\n\n\u003E   \u6587\u6863\u63d0\u4f9b\u7684\u53c2\u6570\u57fa\u4e8e 4.0 \u53ca\u4ee5\u540e\u7684\u7248\u672c\n\u003E\n\u003E   \u6709\u4e9b\u53c2\u6570\u4ecd\u7136\u5b58\u5728\uff0c\u4f46\u662f\u7531\u4e8e\u4e0d\u63a8\u8350\u4f7f\u7528\uff0c\u8fd9\u91cc\u4e0d\u4f1a\u4ecb\u7ecd\uff08\u5982 UUID\uff09\u3002\n\n**\u63d0\u9192\uff1a\u770b\u914d\u7f6e\u524d\uff0c\u4e00\u5b9a\u8981\u770b\u7b2c\u4e8c\u7ae0\u7684\u5bf9\u8c61\u5173\u7cfb\u6620\u5c04\uff0c\u5426\u5219\u4e0d\u4f1a\u660e\u767d\u8fd9\u4e9b\u53c2\u6570\u7684\u7528\u9014\u3002**\n\n**\u53c2\u6570\u7684\u914d\u7f6e\u65b9\u5f0f\u5728\u7b2c\u4e00\u7ae0\u4e2d\uff0c\u9488\u5bf9\u4e0d\u540c\u7684\u96c6\u6210\u73af\u5883\u90fd\u5199\u4e86\u8be6\u7ec6\u7684\u6587\u6863\u3002**\n\n\u901a\u7528 Mapper \u63d0\u4f9b\u4e86\u4e0b\u9762\u8fd9\u4e9b\u53c2\u6570\uff1a\n\n1.  mappers\n2.  IDENTITY\n3.  ORDER\n4.  catalog\n5.  schema\n6.  notEmpty\n7.  style\n8.  enableMethodAnnotation\n9.  useSimpleType\n10.  usePrimitiveType\n11.  simpleTypes\n12.  enumAsSimpleType\n13.  wrapKeyword\n14.  checkExampleEntityClass\n15.  safeDelete\n16.  useJavaType\n\n\u4e0b\u9762\u5206\u522b\u5bf9\u8fd9\u4e9b\u53c2\u6570\u8fdb\u884c\u4ecb\u7ecd\u3002\n\n### 3.1 mappers\n\n\u5728 4.0 \u4ee5\u524d\u8fd9\u662f\u4e00\u4e2a\u975e\u5e38\u91cd\u8981\u7684\u53c2\u6570\uff0c\u5f53\u65f6\u53ea\u6709\u901a\u8fc7 mappers \u914d\u7f6e\u8fc7\u7684\u63a5\u53e3\u624d\u80fd\u771f\u6b63\u8c03\u7528\uff0c\u7531\u4e8e\u5f88\u591a\u4eba\u4e0d\u6ce8\u610f\u770b\u6587\u6863\uff0c\u901a\u7528 Mapper 90% \u7684\u95ee\u9898\u90fd\u51fa\u5728\u8fd9\u4e2a\u53c2\u6570\u4e0a\u3002\n\n4.0 \u4e4b\u540e\uff0c\u589e\u52a0\u4e86\u4e00\u4e2a `@RegisterMapper` \u6ce8\u89e3\uff0c\u901a\u7528 Mapper \u4e2d\u63d0\u4f9b\u7684\u6240\u6709\u63a5\u53e3\u90fd\u6709\u8fd9\u4e2a\u6ce8\u89e3\uff0c\u6709\u4e86\u8be5\u6ce8\u89e3\u540e\uff0c\u901a\u7528 Mapper \u4f1a\u81ea\u52a8\u89e3\u6790\u6240\u6709\u7684\u63a5\u53e3\uff0c\u5982\u679c\u7236\u63a5\u53e3\uff08\u9012\u5f52\u5411\u4e0a\u627e\u5230\u7684\u6700\u9876\u5c42\uff09\u5b58\u5728\u6807\u8bb0\u8be5\u6ce8\u89e3\u7684\u63a5\u53e3\uff0c\u5c31\u4f1a\u81ea\u52a8\u6ce8\u518c\u4e0a\u3002\u56e0\u6b64 4.0 \u540e\u4f7f\u7528\u901a\u7528 Mapper \u63d0\u4f9b\u7684\u65b9\u6cd5\u65f6\uff0c\u4e0d\u9700\u8981\u5728\u914d\u7f6e\u8fd9\u4e2a\u53c2\u6570\u3002\n\n\u5f53\u4f60\u81ea\u5df1\u6269\u5c55\u901a\u7528\u63a5\u53e3\u65f6\uff0c\u5efa\u8bae\u52a0\u4e0a\u8be5\u6ce8\u89e3\uff0c\u5426\u5219\u5c31\u8981\u914d\u7f6e `mappers` \u53c2\u6570\u3002\n\n### 3.2  IDENTITY\n\n\u53d6\u56de\u4e3b\u952e\u7684\u65b9\u5f0f\uff0c\u53ef\u4ee5\u914d\u7f6e\u7684\u503c\u5982 2.3.2 \u4e2d\u6240\u5217\u7684\u6570\u636e\u5e93\u7c7b\u578b\uff1a\n\n-   **DB2**: `VALUES IDENTITY_VAL_LOCAL()`\n-   **MYSQL**: `SELECT LAST_INSERT_ID()`\n-   **SQLSERVER**: `SELECT SCOPE_IDENTITY()`\n-   **CLOUDSCAPE**: `VALUES IDENTITY_VAL_LOCAL()`\n-   **DERBY**: `VALUES IDENTITY_VAL_LOCAL()`\n-   **HSQLDB**: `CALL IDENTITY()`\n-   **SYBASE**: `SELECT @@IDENTITY`\n-   **DB2_MF**: `SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1`\n-   **INFORMIX**: `select dbinfo('sqlca.sqlerrd1') from systables where tabid=1`\n\n\u914d\u7f6e\u65f6\uff0c\u5199\u4e3a\uff1a\n\n```\nIDENTITY=MYSQL\n```\n\n\u8fd9\u4e2a\u53c2\u6570\u914d\u7f6e\u7684\u540c\u65f6\uff0c\u8fd8\u7ecf\u5e38\u4f34\u7740 3.2 \u4e2d\u7684 ORDER \u53c2\u6570\u3002\n\n### 3.3  ORDER\n\n`\u003CselectKey\u003E`\u4e2d\u7684`order`\u5c5e\u6027\uff0c\u53ef\u9009\u503c\u4e3a`BEFORE`\u548c`AFTER`\n\n\u5728 3.1 \u7684\u914d\u7f6e\u4ee5\u53ca 2.3.2 \u548c 2.3.3 \u4e2d\u90fd\u63d0\u5230\u4e86\u8fd9\u4e2a\u53c2\u6570\u3002\n\n\u5728\u652f\u6301\u4e3b\u952e\u9012\u589e\uff0c\u6ee1\u8db3 2.3.2 \u4e2d\u7684\u60c5\u51b5\u65f6\uff0c\u914d\u7f6e\u5982\u4e0b\uff1a\n\n```\nORDER=AFTER\n```\n\n\u5728\u7c7b\u4f3cOracle\u5e8f\u5217\u6216\u8005\u901a\u7528\u7684 UUID \u65f6\uff0c\u914d\u7f6e\u5982\u4e0b\uff1a\n\n```\nORDER=BEFORE\n```\n\n### 3.4  catalog\n\n\u6570\u636e\u5e93\u7684`catalog`\uff0c\u5982\u679c\u8bbe\u7f6e\u8be5\u503c\uff0c\u67e5\u8be2\u7684\u65f6\u5019\u8868\u540d\u4f1a\u5e26`catalog`\u8bbe\u7f6e\u7684\u524d\u7f00\u3002\n\n### 3.5  schema\n\n\u540c`catalog`\uff0c`catalog`\u4f18\u5148\u7ea7\u9ad8\u4e8e`schema`\u3002\n\n### 3.6  notEmpty\n\n`insertSelective` \u548c `updateByPrimaryKeySelective` \u4e2d\uff0c\u662f\u5426\u5224\u65ad\u5b57\u7b26\u4e32\u7c7b\u578b `!=''`\u3002\n\n\u914d\u7f6e\u65b9\u5f0f\uff1a\n\n```\nnotEmpty=true\n```\n\n### 3.7  style\n\n\u5b9e\u4f53\u548c\u8868\u8f6c\u6362\u65f6\u7684\u9ed8\u8ba4\u89c4\u5219\uff0c\u5728 2.2 \u548c 2.2.1 \u4e2d\u90fd\u63d0\u5230\u4e86\u8fd9\u4e2a\u53c2\u6570\uff0c\u53ef\u9009\u503c\u5982\u4e0b\uff1a\n\n-   normal\uff1a\u539f\u503c\n-   camelhump\uff1a\u9a7c\u5cf0\u8f6c\u4e0b\u5212\u7ebf\n-   uppercase\uff1a\u8f6c\u6362\u4e3a\u5927\u5199\n-   lowercase\uff1a\u8f6c\u6362\u4e3a\u5c0f\u5199\n-   camelhumpAndUppercase\uff1a\u9a7c\u5cf0\u8f6c\u4e0b\u5212\u7ebf\u5927\u5199\u5f62\u5f0f\n-   camelhumpAndLowercase\uff1a\u9a7c\u5cf0\u8f6c\u4e0b\u5212\u7ebf\u5c0f\u5199\u5f62\u5f0f\n\n\u914d\u7f6e\u65b9\u5f0f\u5982\u4e0b\uff1a\n\n```\nstyle=camelhumpAndUppercase\n```\n\n### 3.8  enableMethodAnnotation\n\n\u53ef\u4ee5\u63a7\u5236\u662f\u5426\u652f\u6301\uff08getter \u548c setter\uff09\u5728\u65b9\u6cd5\u4e0a\u4f7f\u7528\u6ce8\u89e3\uff0c\u9ed8\u8ba4`false`\u3002\n\n\u914d\u7f6e\u65b9\u5f0f\u5982\u4e0b\uff1a\n\n```\nenableMethodAnnotation=true\n```\n\n\u542f\u7528\u540e\uff0c\u53ef\u4ee5\u6309\u7167\u4e0b\u9762\u65b9\u5f0f\u4f7f\u7528\uff1a\n\n```java\nprivate String name;\n\n@Column(name = \"user_name\")\npublic void setName(String name){\n  this.name = name;\n}\n```\n\n### 3.9  useSimpleType\n\n\u9ed8\u8ba4 `true`\uff0c\u542f\u7528\u540e\u5224\u65ad\u5b9e\u4f53\u7c7b\u5c5e\u6027\u662f\u5426\u4e3a\u8868\u5b57\u6bb5\u65f6\u6821\u9a8c\u5b57\u6bb5\u662f\u5426\u4e3a\u7b80\u5355\u7c7b\u578b\uff0c\u5982\u679c\u4e0d\u662f\u5c31\u5ffd\u7565\u8be5\u5c5e\u6027\uff0c\u8fd9\u4e2a\u914d\u7f6e\u4f18\u5148\u7ea7\u9ad8\u4e8e\u6240\u6709\u6ce8\u89e3\u3002\n\n**\u6ce8\u610f\uff1abyte, short, int, long, float, double, char, boolean \u7531\u4e8e\u5b58\u5728\u9ed8\u8ba4\u503c\uff0c\u8fd9\u91cc\u4e0d\u4f1a\u4f5c\u4e3a\u7b80\u5355\u7c7b\u578b\u5bf9\u5f85\uff01\u4e5f\u5c31\u662f\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u8fd9\u4e9b\u5b57\u6bb5\u4e0d\u4f1a\u548c\u8868\u5b57\u6bb5\u8fdb\u884c\u6620\u5c04\u30022.2.5 \u4e2d\u4e5f\u5f3a\u8c03\u4e86\u8fd9\u4e00\u70b9\u3002**\n\n\u914d\u7f6e\u65b9\u5f0f\u5982\u4e0b\uff1a\n\n```\nuseSimpleType=true\n```\n\n### 3.10  usePrimitiveType\n\n\u4e3a\u4e86\u65b9\u4fbf\u90e8\u5206\u8fd8\u5728\u4f7f\u7528\u57fa\u672c\u7c7b\u578b\u7684\u5b9e\u4f53\uff0c\u589e\u52a0\u4e86\u8be5\u5c5e\u6027\uff0c\u53ea\u6709\u914d\u7f6e\u8be5\u5c5e\u6027\uff0c\u5e76\u4e14\u8bbe\u7f6e\u4e3a `true` \u624d\u4f1a\u751f\u6548\uff0c\u542f\u7528\u540e\uff0c\u4f1a\u626b\u63cf 8 \u79cd\u57fa\u672c\u7c7b\u578b\u3002\n\n\u914d\u7f6e\u65b9\u5f0f\u5982\u4e0b\uff1a\n\n```\nusePrimitiveType=true\n```\n\n### 3.11 simpleTypes\n\n\u9ed8\u8ba4\u7684\u7b80\u5355\u7c7b\u578b\u5728 `SimpleTypeUtil` \u4e2d\uff0c\u4f7f\u7528\u8be5\u53c2\u6570\u53ef\u4ee5\u589e\u52a0\u989d\u5916\u7684\u7b80\u5355\u7c7b\u578b\uff0c\u901a\u8fc7\u9017\u53f7\u9694\u5f00\u7684\u5168\u9650\u5b9a\u7c7b\u540d\u6dfb\u52a0\u3002\n\n\u914d\u7f6e\u65b9\u5f0f\u5982\uff1a\n\n```\nsimpleTypes=xxx.GenderEnum,xxx.JobEnum\n```\n\n### 3.12  enumAsSimpleType\n\n\u7528\u4e8e\u914d\u7f6e\u662f\u5426\u5c06\u679a\u4e3e\u7c7b\u578b\u5f53\u6210\u57fa\u672c\u7c7b\u578b\u5bf9\u5f85\u3002\n\n\u9ed8\u8ba4 simpleType \u4f1a\u5ffd\u7565\u679a\u4e3e\u7c7b\u578b\uff0c\u4f7f\u7528 enumAsSimpleType \u914d\u7f6e\u540e\u4f1a\u628a\u679a\u4e3e\u6309\u7b80\u5355\u7c7b\u578b\u5904\u7406\uff0c\u9700\u8981\u81ea\u5df1\u914d\u7f6e\u597d `typeHandler`\u3002\n\n\u914d\u7f6e\u65b9\u5f0f\u5982\u4e0b\uff1a\n\n```\nenumAsSimpleType=true\n```\n\n### 3.13  wrapKeyword\n\n\u914d\u7f6e\u540e\u4f1a\u81ea\u52a8\u5904\u7406\u5173\u952e\u5b57\uff0c\u53ef\u4ee5\u914d\u7684\u503c\u548c\u6570\u636e\u5e93\u6709\u5173\u3002\n\n\u4f8b\u5982 sqlserver \u53ef\u4ee5\u914d\u7f6e\u4e3a `[{0}]`\uff0c\u4f7f\u7528 `{0}` \u66ff\u4ee3\u539f\u6765\u7684\u5217\u540d\u3002\n\nMySql \u5bf9\u5e94\u7684\u914d\u7f6e\u5982\u4e0b\uff1a\n\n```\nwrapKeyword=`{0}`\n```\n\n\u4f7f\u7528\u8be5\u914d\u7f6e\u540e\uff0c\u7c7b\u4f3c `private String order` \u5c31\u4e0d\u9700\u8981\u901a\u8fc7 `@Column` \u6765\u6307\u5b9a\u522b\u540d\u3002\n\n### 3.14  checkExampleEntityClass\n\n\u9ed8\u8ba4 `false` \u7528\u4e8e\u6821\u9a8c\u901a\u7528 `Example` \u6784\u9020\u53c2\u6570 `entityClass` \u662f\u5426\u548c\u5f53\u524d\u8c03\u7528\u7684 `Mapper\u003CEntityClass\u003E` \u7c7b\u578b\u4e00\u81f4\u3002\n\n\u5047\u8bbe\u5b58\u5728\u4e0b\u9762\u4ee3\u7801\uff1a\n\n```java\nExample example = new Example(City.class);\nexample.xxx...;//\u8bbe\u7f6e\u6761\u4ef6\u7684\u65b9\u6cd5\ncountryMapper.selectByExample(example);\n```\n\n\u6ce8\u610f\uff0c\u8fd9\u91cc\u4f7f\u7528 `City` \u521b\u5efa\u7684 `Example`\uff0c\u672c\u8be5\u4f7f\u7528 `cityMapper` \u6765\u8c03\u7528\uff0c\u4f46\u662f\u8fd9\u91cc\u4f7f\u7528\u4e86 `countryMapper`\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4f1a\u51fa\u73b0\u5b57\u6bb5\u4e0d\u5339\u914d\u7684\u9519\u8bef\uff0c**\u66f4\u7279\u6b8a\u7684\u60c5\u51b5\u4e0b\u4f1a\u6b63\u597d\u5339\u914d\u5b57\u6bb5\uff0c\u4f46\u662f\u5374\u64cd\u4f5c\u9519\u4e86\u8868\uff01**\n\n\u914d\u7f6e\u8be5\u5b57\u6bb5\u4e3a `true` \u540e\u5c31\u4f1a\u5bf9\u4e0d\u5339\u914d\u7684\u60c5\u51b5\u8fdb\u884c\u6821\u9a8c\uff01\n\n\u914d\u7f6e\u5982\u4e0b\uff1a\n\n```\ncheckExampleEntityClass=true\n```\n\n### 3.15 safeDelete\n\n\u914d\u7f6e\u4e3a true \u540e\uff0cdelete \u548c deleteByExample \u90fd\u5fc5\u987b\u8bbe\u7f6e\u67e5\u8be2\u6761\u4ef6\u624d\u80fd\u5220\u9664\uff0c\u5426\u5219\u4f1a\u629b\u51fa\u5f02\u5e38\u3002\n\n\u914d\u7f6e\u5982\u4e0b\uff1a\n\n```\nsafeDelete=true\n```\n\n\u4f7f\u7528\u6548\u679c\uff1a\n\n```\nCaused by: tk.mybatis.mapper.MapperException: \u003C[\u901a\u7528 Mapper \u914d\u7f6e safeDelete=true]\u003E delete \u65b9\u6cd5\u6ca1\u6709\u6307\u5b9a\u67e5\u8be2\u6761\u4ef6\uff0c\u4e0d\u5141\u8bb8\u6267\u884c\u8be5\u64cd\u4f5c!\n\tat tk.mybatis.mapper.util.OGNL.notAllNullParameterCheck(OGNL.java:91)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.lang.reflect.Method.invoke(Method.java:497)\n\tat org.apache.ibatis.ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:899)\n\tat org.apache.ibatis.ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1544)\n\t... 53 more\n```\n\n### 3.16 useJavaType\n\n\u8bbe\u7f6e true \u65f6\uff0c\u53c2\u6570\u4e2d\u4f1a\u589e\u52a0 javaType \u8bbe\u7f6e\uff0c\u5982 `{id, javaType=java.lang.Long}`\u3002\u5728 `\u003CresultMap\u003E` \u4e2d\u4e5f\u4f1a\u8bbe\u7f6e `javaType` \u5c5e\u6027\u3002\n\n\u914d\u7f6e\u5982\u4e0b\uff1a\n\n```\nuseJavaType=true\n```\n\n\u5bf9\u4e8e\u4f7f\u7528 `User extends Pk\u003CLong\u003E` \u5f62\u5f0f\u65f6\uff0c\u9700\u8981\u8bbe\u7f6e\uff0c\u5426\u5219 mybatis \u4f4e\u7248\u672c(\u003C3.4.0) \u65e0\u6cd5\u8bc6\u522b\u7c7b\u578b\u3002\n\n\u003E   \u5efa\u8bae\u5347\u7ea7\u5230 mybatis 3.4.x \u7684\u6700\u65b0\u7248\u672c\n\n\u4f8b\u5982\uff1a\n\n```java\nclass Pk\u003CT\u003E {\n  private T id;\n\n  public T getId() {\n    return id;\n  }\n\n  public void setId(T id) {\n    this.id = id;\n  }\n}\n\nclass User extends Pk\u003CLong\u003E {\n  private String name;\n}\n```\n\n\u5982\u679c\u4e0d\u8bbe\u7f6e javaType\uff0c\u4f4e\u7248\u672c\u7684 MyBatis \u4f1a\u8ba4\u4e3a id \u7684\u7c7b\u578b\u4e3a Object\u3002\u5347\u7ea7 MyBatis \u5230 3.4.0+ \u6700\u597d\u3002\n\n\u8bbe\u7f6e `useJavaType` \u53ea\u5bf9\u901a\u7528 Mapper \u81ea\u5df1\u65b9\u6cd5\u6709\u6548\uff0c\u81ea\u5df1\u5199\u7684\u5176\u4ed6\u65b9\u6cd5\u8fd8\u9700\u8981\u81ea\u5df1\u6307\u5b9a\u3002\n\n\u003E   **\u7279\u522b\u6ce8\u610f**\n\u003E\n\u003E   \u4f7f\u7528 useJavaType=true \u540e\uff0c\u8c03\u7528 `ByPrimaryKey` \u7c7b\u7684\u65b9\u6cd5\u65f6\uff0c\u9700\u8981\u6309\u7167\u5b9e\u4f53\u4e2d\u5bf9\u5e94\u7684\u7c7b\u578b\u6765\u6307\u5b9a\uff0c\u4f8b\u5982\u4e3b\u952e\u7c7b\u578b\u4e3a `Long` \u65f6\uff0c\u5fc5\u987b `mapper.selectByPrimaryKey(1L)`\u3002\n\u003E\n\u003E   \u4e0d\u914d\u7f6e\u65f6\uff0c\u6ca1\u6709\u8fd9\u4e2a\u9650\u5236\uff0c\u53ef\u4ee5\u4f7f\u7528  `mapper.selectByPrimaryKey(1)` \u6216  `mapper.selectByPrimaryKey(\"1\")` \u7b49\u7c7b\u578b\u3002"},{"id":"e3c82c9","pId":0,"name":"4.generator","parent":"","sort_id":208208,"order":0,"extname":null,"open":true},{"id":"4.generator","pId":"e3c82c9","name":"4.generator","parent":"4.generator","order":0,"sort_id":208209,"extname":".md","isHidden":false,"content":"## \u56db\u3001\u4ee3\u7801\u751f\u6210\u5668\n\n"},{"id":"86f5854","pId":0,"name":"5.extend","parent":"","sort_id":208210,"order":0,"extname":null,"open":true},{"id":"5.extend","pId":"86f5854","name":"5.extend","parent":"5.extend","order":0,"sort_id":208211,"extname":".md","isHidden":false,"content":"## \u4e94\u3001\u6269\u5c55\u901a\u7528\u63a5\u53e3\n\n"},{"id":"6208c4e","pId":0,"name":"6.example","parent":"","sort_id":208212,"order":0,"extname":null,"open":true},{"id":"6.example","pId":"6208c4e","name":"6.example","parent":"6.example","order":0,"sort_id":208213,"extname":".md","isHidden":false,"content":"## \u516d\u3001Example \u7528\u6cd5\n\n\u901a\u7528 Mapper \u4e2d\u7684 Example \u65b9\u6cd5\u6709\u4e24\u5927\u7c7b\u5b9a\u4e49\uff0c\u4e00\u4e2a\u53c2\u6570\u548c\u4e24\u4e2a\u53c2\u6570\u7684\uff0c\u4f8b\u5982\u4e0b\u9762\u4e24\u4e2a\uff1a\n\n```java\nList\u003CT\u003E selectByExample(Object example);\n\nint updateByExampleSelective(@Param(\"record\") T record, @Param(\"example\") Object example);\n```\n\n\u6240\u6709 Example \u65b9\u6cd5\u4e2d\u7684 example \u7c7b\u578b\u90fd\u662f `Object` \u7c7b\u578b\uff0c\u8fd9\u662f\u56e0\u4e3a\u901a\u7528 Mapper \u652f\u6301\u6240\u6709\u7b26\u5408 Example \u7ed3\u6784\u7684\u53c2\u6570\uff0c\u4f8b\u5982\u901a\u8fc7 MBG \u751f\u6210\u7684 CountryExample\u3001UserExample \u7c7b\u3002\u8fd8\u6709\u901a\u7528 Mapper \u4e2d\u63d0\u4f9b\u7684\u901a\u7528 Example\uff0c\u4ee5\u53ca\u652f\u6301 Java8 \u65b9\u6cd5\u5f15\u7528\u7684 Weekend \u7c7b\u578b\u3002\n\n\u003E   \u914d\u7f6e\u4e2d\u6709\u4e00\u4e2a\u548c Example \u6709\u5173\u7684\u53c2\u6570\uff0c\u70b9\u51fb\u67e5\u770b [3.14  checkExampleEntityClass](3.config#314--checkexampleentityclass)\u3002\n\n### 6.1 MBG \u751f\u6210\u7684 Example\n\n\u7528\u6cd5\u5982\u4e0b\uff1a\n\n```java\nCountryExample example = new CountryExample();\nexample.createCriteria().andCountrynameLike(\"A%\");\nexample.or().andIdGreaterThan(100);\nexample.setDistinct(true);\nint count = mapper.deleteByExample(example);\n```\n\n\u5bf9\u4e8e\u7684 SQL \u65e5\u5fd7\u5982\u4e0b\uff1a\n\n```sql\nDEBUG [main] - ==\u003E  Preparing: DELETE FROM country WHERE ( countryname like ? ) or ( Id \u003E ? ) \nDEBUG [main] - ==\u003E Parameters: A%(String), 100(Integer)\nDEBUG [main] - \u003C==    Updates: 95\n```\n\n\u751f\u6210\u7684 CountryExample \u4e2d\u5305\u542b\u4e86\u548c\u5b57\u6bb5\u76f8\u5173\u7684\u591a\u79cd\u65b9\u6cd5\uff0c\u6839\u636e\u81ea\u5df1\u7684\u9700\u8981\u8bbe\u7f6e\u76f8\u5e94\u7684\u6761\u4ef6\u5373\u53ef\u3002\n\n### 6.2 \u901a\u7528 Example\n\n\u8fd9\u662f\u7531\u901a\u7528 Mapper \u63d0\u4f9b\u7684\u4e00\u4e2a\u7c7b\uff0c\u8fd9\u4e2a\u7c7b\u548c MBG \u751f\u6210\u7684\u76f8\u6bd4\uff0c\u9700\u8981\u81ea\u5df1\u8bbe\u7f6e\u5c5e\u6027\u540d\u3002\u8fd9\u4e2a\u7c7b\u8fd8\u989d\u5916\u63d0\u4f9b\u4e86\u66f4\u591a\u7684\u65b9\u6cd5\u3002\n\n#### 6.2.1 \u67e5\u8be2\n\n\u793a\u4f8b\uff1a\n\n```java\nExample example = new Example(Country.class);\nexample.setForUpdate(true);\nexample.createCriteria().andGreaterThan(\"id\", 100).andLessThan(\"id\",151);\nexample.or().andLessThan(\"id\", 41);\nList\u003CCountry\u003E countries = mapper.selectByExample(example);\n```\n\n\u65e5\u5fd7\uff1a\n\n```sql\nDEBUG [main] - ==\u003E  Preparing: SELECT id,countryname,countrycode FROM country WHERE ( id \u003E ? and id \u003C ? ) or ( id \u003C ? ) ORDER BY id desc FOR UPDATE \nDEBUG [main] - ==\u003E Parameters: 100(Integer), 151(Integer), 41(Integer)\nDEBUG [main] - \u003C==      Total: 90\n```\n\n#### 6.2.2 \u52a8\u6001 SQL\n\n\u793a\u4f8b\uff1a\n\n```java\nExample example = new Example(Country.class);\nExample.Criteria criteria = example.createCriteria();\nif(query.getCountryname() != null){\n    criteria.andLike(\"countryname\", query.getCountryname() + \"%\");\n}\nif(query.getId() != null){\n    criteria.andGreaterThan(\"id\", query.getId());\n}\nList\u003CCountry\u003E countries = mapper.selectByExample(example);\n```\n\n\u65e5\u5fd7\uff1a\n\n```sql\nDEBUG [main] - ==\u003E  Preparing: SELECT id,countryname,countrycode FROM country WHERE ( countryname like ? ) ORDER BY id desc \nDEBUG [main] - ==\u003E Parameters: China%(String)\nDEBUG [main] - \u003C==      Total: 1\n```\n\n#### 6.2.3 \u6392\u5e8f\n\n\u793a\u4f8b\uff1a\n\n```java\nExample example = new Example(Country.class);\nexample.orderBy(\"id\").desc().orderBy(\"countryname\").orderBy(\"countrycode\").asc();\nList\u003CCountry\u003E countries = mapper.selectByExample(example);\n```\n\n\u65e5\u5fd7\uff1a\n\n```sql\nDEBUG [main] - ==\u003E  Preparing: SELECT id,countryname,countrycode FROM country order by id DESC,countryname,countrycode ASC \nDEBUG [main] - ==\u003E Parameters: \nDEBUG [main] - \u003C==      Total: 183\n```\n\n#### 6.2.4 \u53bb\u91cd\n\n\u793a\u4f8b\uff1a\n\n```java\nCountryExample example = new CountryExample();\n//\u8bbe\u7f6e distinct\nexample.setDistinct(true);\nexample.createCriteria().andCountrynameLike(\"A%\");\nexample.or().andIdGreaterThan(100);\nList\u003CCountry\u003E countries = mapper.selectByExample(example);\n```\n\n\u65e5\u5fd7\uff1a\n\n```sql\nDEBUG [main] - ==\u003E  Preparing: SELECT distinct id,countryname,countrycode FROM country WHERE ( countryname like ? ) or ( Id \u003E ? ) ORDER BY id desc \nDEBUG [main] - ==\u003E Parameters: A%(String), 100(Integer)\nDEBUG [main] - \u003C==      Total: 95\n```\n\n#### 6.2.5 \u8bbe\u7f6e\u67e5\u8be2\u5217\n\n\u793a\u4f8b\uff1a\n\n```java\nExample example = new Example(Country.class);\nexample.selectProperties(\"id\", \"countryname\");\nList\u003CCountry\u003E countries = mapper.selectByExample(example);\n```\n\n\u65e5\u5fd7\uff1a\n\n```sql\nDEBUG [main] - ==\u003E  Preparing: SELECT id , countryname FROM country ORDER BY id desc \nDEBUG [main] - ==\u003E Parameters: \nDEBUG [main] - \u003C==      Total: 183\n```\n\n\u003E   \u9664\u4e86\u8fd9\u91cc\u63d0\u5230\u7684\u65b9\u6cd5\u5916\uff0c\u8fd8\u6709\u5f88\u591a\u5176\u4ed6\u7684\u65b9\u6cd5\uff0c\u53ef\u4ee5\u67e5\u770b Example \u6e90\u7801\u8fdb\u884c\u4e86\u89e3\u3002\n\n### 6.3 Example.builder \u65b9\u5f0f\n\n\u793a\u4f8b\uff1a\n\n```java\nExample example = Example.builder(Country.class)\n        .select(\"countryname\")\n        .where(Sqls.custom().andGreaterThan(\"id\", 100))\n        .orderByAsc(\"countrycode\")\n        .forUpdate()\n        .build();\nList\u003CCountry\u003E countries = mapper.selectByExample(example);\n```\n\n\u65e5\u5fd7\uff1a\n\n```sql\nDEBUG [main] - ==\u003E  Preparing: SELECT countryname FROM country WHERE ( id \u003E ? ) order by countrycode Asc FOR UPDATE \nDEBUG [main] - ==\u003E Parameters: 100(Integer)\nDEBUG [main] - \u003C==      Total: 83\n```\n\n### 6.4 Weekend\n\n\u4f7f\u7528 6.2 \u548c 6.3 \u4e2d\u7684 Example \u65f6\uff0c\u9700\u8981\u81ea\u5df1\u8f93\u5165\u5c5e\u6027\u540d\uff0c\u4f8b\u5982 `\"countryname\"`\uff0c\u5047\u8bbe\u8f93\u5165\u9519\u8bef\uff0c\u6216\u8005\u6570\u636e\u5e93\u6709\u53d8\u5316\uff0c\u8fd9\u91cc\u5f88\u53ef\u80fd\u5c31\u4f1a\u51fa\u9519\uff0c\u56e0\u6b64\u57fa\u4e8e Java 8 \u7684\u65b9\u6cd5\u5f15\u7528\u662f\u4e00\u79cd\u66f4\u5b89\u5168\u7684\u7528\u6cd5\uff0c\u5982\u679c\u4f60\u4f7f\u7528 Java 8\uff0c\u4f60\u53ef\u4ee5\u8bd5\u8bd5 Weekend\u3002\n\n\u793a\u4f8b\uff1a\n\n```java\nList\u003CCountry\u003E selectByWeekendSql = mapper.selectByExample(new Example.Builder(Country.class)\n        .where(WeekendSqls.\u003CCountry\u003Ecustom().andLike(Country::getCountryname, \"%a%\")\n                .andGreaterThan(Country::getCountrycode, \"123\"))\n        .build());\n```\n\n\u65e5\u5fd7\uff1a\n\n```sql\nDEBUG [main] - ==\u003E  Preparing: SELECT id,countryname,countrycode FROM country WHERE ( countryname like ? and countrycode \u003E ? ) \nDEBUG [main] - ==\u003E Parameters: %a%(String), 123(String)\nDEBUG [main] - \u003C==      Total: 151\n```\n\n\u5728\u4ee3\u7801\u4e2d\u7684 `Country::getCountryname` \u5c31\u662f\u65b9\u6cd5\u5f15\u7528\uff0c\u901a\u8fc7\u8be5\u65b9\u6cd5\u53ef\u4ee5\u81ea\u52a8\u8f6c\u6362\u5bf9\u5e94\u7684\u5217\u540d\u3002"},{"id":"82aa45f","pId":0,"name":"7.others","parent":"","sort_id":213169,"order":0,"extname":null,"open":true},{"id":"7.1.cache","pId":"82aa45f","name":"7.1.cache","parent":"7.others","order":0,"sort_id":213170,"extname":".md","isHidden":false,"content":"### 7.1 \u4e8c\u7ea7\u7f13\u5b58\n\n\u5173\u4e8e\u4e8c\u7ea7\u7f13\u5b58\u7684\u4f8b\u5b50\uff0c\u53ef\u4ee5\u67e5\u770b\u6d4b\u8bd5\u4e2d\u7684 `tk.mybatis.mapper.cache.CacheTest`\u3002\n\n\u9996\u5148\u9700\u8981\u5f00\u542f\u4e8c\u7ea7\u7f13\u5b58\uff1a\n\n```xml\n\u003C!DOCTYPE configuration\n        PUBLIC \"-//mybatis.org//DTD Config 3.0//EN\"\n        \"http://mybatis.org/dtd/mybatis-3-config.dtd\"\u003E\n\u003Cconfiguration\u003E\n    \u003Csettings\u003E\n        \u003Csetting name=\"cacheEnabled\" value=\"true\"/\u003E\n    \u003C/settings\u003E\n    \u003C!-- \u5176\u4ed6 --\u003E\n\u003C/configuration\u003E\n```\n\n#### 7.1.1 \u53ea\u4f7f\u7528\u63a5\u53e3\n\n\u53ea\u7528\u63a5\u53e3\u65f6\uff0c\u53ea\u9700\u8981\u52a0\u4e00\u4e2a\u7f13\u5b58\u7684\u6ce8\u89e3\uff0c\u793a\u4f8b\u5982\u4e0b\uff1a\n\n```java\n/**\n * \u53ea\u6709\u63a5\u53e3\u65f6\uff0c\u52a0\u4e0b\u9762\u7684\u6ce8\u89e3\u5373\u53ef\n */\n@CacheNamespace\npublic interface CountryCacheMapper extends Mapper\u003CCountry\u003E {\n\n}\n```\n\n\u5bf9\u7f13\u5b58\u7684\u8be6\u7ec6\u914d\u7f6e\u53ef\u4ee5\u901a\u8fc7\u8be5\u6ce8\u89e3\u63d0\u4f9b\u7684\u5c5e\u6027\u8fdb\u884c\u914d\u7f6e\u3002\n\n#### 7.1.2 \u63a5\u53e3\u548c XML \u6df7\u5408\n\n\u003E \u7531\u4e8e MyBatis \u76ee\u524d\u5904\u7406 XML \u548c \u63a5\u53e3\u4e2d\u7684\u5f15\u7528\u65f6\u5b58\u5728 BUG\uff0c\u6240\u4ee5\u53ea\u6709\u8fd9\u91cc\u63d0\u4f9b\u7684\u4e00\u79cd\u65b9\u5f0f\u8fdb\u884c\u914d\u7f6e\u3002\u4e5f\u5c31\u662f\u5728 XML \u4e2d\u914d\u7f6e `\u003Ccache/\u003E`\uff0c\u5728\u63a5\u53e3\u4e2d\u4f7f\u7528 `@CacheNamespaceRef(CountryCacheRefMapper.class)` \u5f15\u7528\u6ce8\u89e3\u3002\n\u003E\n\u003E \u5173\u4e8e\u8be5 BUG \u53ef\u4ee5\u67e5\u770b\u4e0b\u9762\u94fe\u63a5\uff1a\n\u003E\n\u003E https://github.com/mybatis/mybatis-3/issues/1194\n\n\u5728 XML \u4e2d\u5b9a\u4e49\u7f13\u5b58\uff1a\n\n```xml\n\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?\u003E\n\u003C!DOCTYPE mapper\n        PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\"\n        \"http://mybatis.org/dtd/mybatis-3-mapper.dtd\"\u003E\n\u003Cmapper namespace=\"tk.mybatis.mapper.cache.CountryCacheRefMapper\"\u003E\n    \u003Ccache/\u003E\n    \u003Cselect id=\"selectById\" resultType=\"tk.mybatis.mapper.base.Country\"\u003E\n        select * from country where id = #{id}\n    \u003C/select\u003E\n\u003C/mapper\u003E\n```\n\n\u5728\u63a5\u53e3\u4e2d\u914d\u7f6e\u6ce8\u89e3\u5f15\u7528\uff1a\n\n```java\n@CacheNamespaceRef(CountryCacheRefMapper.class)\n//\u6216\u8005 @CacheNamespaceRef(name = \"tk.mybatis.mapper.cache.CountryCacheRefMapper\")\npublic interface CountryCacheRefMapper extends Mapper\u003CCountry\u003E {\n\n    /**\n     * \u5b9a\u4e49\u5728 XML \u4e2d\u7684\u65b9\u6cd5\n     *\n     * @param id\n     * @return\n     */\n    Country selectById(Integer id);\n}\n\n```\n\n`@CacheNamespaceRef` \u6307\u5b9a\u7684\u662f\u7f13\u5b58\u7684 `namespace`\uff0c\u5c31\u662f XML \u4e2d `\u003Cmapper\u003E`  \u4e2d\u7684 `namespace` \u5c5e\u6027\u3002\n\n#### 7.1.3 \u6f5c\u5728\u7684\u95ee\u9898\n\n\u901a\u7528 Mapper \u4e2d\u90e8\u5206 insert, update \u65b9\u6cd5\u4f7f\u7528\u4e86 `@Options` \u6ce8\u89e3\uff0c\u5728 4.0 \u7248\u672c\u4e2d update \u65b9\u6cd5\u90fd\u53bb\u6389\u4e86\u8fd9\u4e2a\u6ce8\u89e3\uff0c\u4f46\u662f\u90e8\u5206 insert \u5fc5\u987b\u4fdd\u7559\u3002\n\n\u003E \u5b58\u5728 `@Options` \u6ce8\u89e3\u7684\u65b9\u6cd5\uff1a\n\u003E\n\u003E 1. `tk.mybatis.mapper.common.special.InsertListMapper` \n\u003E    - `int insertList(List\u003CT\u003E recordList);` \n\u003E 2. `tk.mybatis.mapper.common.special.InsertUseGeneratedKeysMapper` \n\u003E    - `int insertUseGeneratedKeys(T record);` \n\u003E 3. `tk.mybatis.mapper.common.sqlserver.InsertMapper` \n\u003E    - `int insert(T record);` \n\u003E 4. `tk.mybatis.mapper.common.sqlserver.InsertSelectiveMapper` \n\u003E    - `int insertSelective(T record);` \n\u003E    \n\u003E **\u8fd9 4 \u4e2a\u65b9\u6cd5\u90fd\u662f\u7279\u6b8a\u7684\u65b9\u6cd5\uff0c\u4e0d\u662f `Mapper\u003CT\u003E` \u63a5\u53e3\u4e2d\u5305\u542b\u7684\u4e24\u4e2a `insert` \u65b9\u6cd5\u3002**\n\nMyBatis \u4e2d\u7684 `@Options` \u6ce8\u89e3\u5728 3.3.x \u7248\u672c\u548c 3.4.0+ \u540e\u7684\u7248\u672c\u4e2d\uff0c\u5bf9 `flushCache` \u65b9\u6cd5\u5b9a\u4e49\u4e0d\u540c\uff0c\u8fd9\u5c31\u5bfc\u81f4\u901a\u7528 Mapper \u4e2d\u65e0\u6cd5\u76f4\u63a5\u914d\u7f6e\u6539\u5c5e\u6027\uff0c\u5728 3.3.x \u7b49\u4f4e\u7248\u672c\u4e2d\uff0c\u8be5\u5c5e\u6027\u9ed8\u8ba4 `false`\uff0c\u56e0\u6b64\u6267\u884c `insert` \u540e\u4e0d\u4f1a\u6e05\u9664\u4e00\u4e8c\u7ea7\u7f13\u5b58\u3002\u5728\u9ad8\u7248\u672c\u4e2d\u4e0d\u5b58\u5728\u8be5\u95ee\u9898\u3002\n\n\u56e0\u6b64\u5982\u679c\u8981\u4f7f\u7528\u4e8c\u7ea7\u7f13\u5b58\uff0c\u5efa\u8bae MyBatis \u4f7f\u7528\u6bd4\u8f83\u65b0\u7684\u7248\u672c\uff0c\u5426\u5219\u9700\u8981\u8003\u8651\u4f7f\u7528 insert \u540e\u53ef\u80fd\u67e5\u8be2\u4e0d\u5230\u7684\u95ee\u9898\u3002\n\n`Options` \u6ce8\u89e3\u4e2d\u7684 `flushCache` \u533a\u522b\u5982\u4e0b\uff1a\n\n3.3.x \u4ee5\u53ca\u66f4\u65e7\u7684\u7248\u672c\u4e2d\uff1a\n\n```java\nboolean flushCache() default false;\n```\n\n3.4.0+\u4e2d\uff1a\n\n```java\n/**\n * The options for the {@link Options#flushCache()}.\n * The default is {@link FlushCachePolicy#DEFAULT}\n */\npublic enum FlushCachePolicy {\n\t/** \u003Ccode\u003Efalse\u003C/code\u003E for select statement; \u003Ccode\u003Etrue\u003C/code\u003E for insert/update/delete statement. */\n\tDEFAULT,\n\t/** Flushes cache regardless of the statement type. */\n\tTRUE,\n\t/** Does not flush cache regardless of the statement type. */\n\tFALSE\n}\n\nFlushCachePolicy flushCache() default FlushCachePolicy.DEFAULT;\n```\n\n\u5f88\u663e\u7136\uff0c\u5728 3.4.0+ \u4e2d\u7684\u5b9a\u4e49\u66f4\u5408\u7406\uff0c\u6240\u4ee5\u5982\u679c\u4f7f\u7528\u4e8c\u7ea7\u7f13\u5b58\uff0c\u5efa\u8bae\u5347\u7ea7\u5230\u6bd4\u8f83\u65b0\u7684\u7248\u672c\u3002"},{"id":"7.2.typehandler","pId":"82aa45f","name":"7.2.typehandler","parent":"7.others","order":0,"sort_id":217647,"extname":".md","isHidden":false,"content":"### 7.2 TypeHandler \u7c7b\u578b\u5904\u7406\u5668\n\n\u672c\u6587\u901a\u8fc7\u4e24\u4e2a\u4f8b\u5b50\u6765\u6f14\u793a typeHandler \u7684\u7528\u6cd5\u3002\n\n\u003E \u793a\u4f8b\u6765\u81ea [base/src/test/java/tk.mybatis.mapper.typehandler](https://github.com/abel533/Mapper/tree/master/base/src/test/java/tk/mybatis/mapper/typehandler) \u5305\u4e2d\u7684\u6d4b\u8bd5\u3002\n\n\u5728\u5f00\u59cb\u4f8b\u5b50\u524d\uff0c\u5148\u4e0a\u76f8\u540c\u7684\u4ee3\u7801\u3002\n\n\u4e00\u4e2a\u7b80\u5355\u7684\u679a\u4e3e\u7c7b\uff1a\n\n```java\npublic enum StateEnum {\n    disabled,\n    enabled,\n}\n```\n\n\u8fd9\u91cc\u6253\u7b97\u7528 MyBatis \u63d0\u4f9b\u7684 `EnumOrdinalTypeHandler`\uff0c\u4e5f\u662f\u6570\u636e\u5e93\u5b58\u50a8\u679a\u4e3e\u5bf9\u5e94\u7684\u5e8f\u53f7\u3002\n\n\u4e00\u4e2a\u7b80\u5355\u7684\u5730\u5740\u7c7b\uff1a\n\n```java\npublic class Address implements Serializable {\n    private static final long serialVersionUID = 1L;\n    private String province;\n    private String city;\n\n    public String getProvince() {\n        return province;\n    }\n\n    public void setProvince(String province) {\n        this.province = province;\n    }\n\n    public String getCity() {\n        return city;\n    }\n\n    public void setCity(String city) {\n        this.city = city;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder builder = new StringBuilder();\n        if(province != null \u0026\u0026 province.length() \u003E 0){\n            builder.append(province);\n        }\n        if(city != null \u0026\u0026 city.length() \u003E 0){\n            builder.append(\"/\").append(city);\n        }\n        return builder.toString();\n    }\n}\n```\n\n\u8fd9\u4e2a\u7c7b\u7528\u6765\u6f14\u793a\u81ea\u5b9a\u4e49\u7c7b\u578b\u7684\u7528\u6cd5\uff0c\u9488\u5bf9\u8be5\u7c7b\u5199\u4e00\u4e2a\u81ea\u5b9a\u4e49\u7684 TypeHandler\uff0c\u5982\u4e0b\uff1a\n\n```java\npublic class AddressTypeHandler extends BaseTypeHandler\u003CAddress\u003E {\n    @Override\n    public void setNonNullParameter(PreparedStatement ps, int i, Address parameter,\n                                    JdbcType jdbcType) throws SQLException {\n        ps.setString(i, parameter.toString());\n    }\n\n    private Address convertToAddress(String addressStr){\n        if(addressStr == null || addressStr.length() == 0){\n            return null;\n        }\n        String[] strings = addressStr.split(\"/\");\n        Address address = new Address();\n        if(strings.length \u003E 0 \u0026\u0026 strings[0].length() \u003E 0){\n            address.setProvince(strings[0]);\n        }\n        if(strings.length \u003E 1 \u0026\u0026 strings[1].length() \u003E 0){\n            address.setCity(strings[1]);\n        }\n        return address;\n    }\n\n    @Override\n    public Address getNullableResult(ResultSet rs, String columnName) throws SQLException {\n        return convertToAddress(rs.getString(columnName));\n    }\n\n    @Override\n    public Address getNullableResult(ResultSet rs, int columnIndex) throws SQLException {\n        return convertToAddress(rs.getString(columnIndex));\n    }\n\n    @Override\n    public Address getNullableResult(CallableStatement cs, int columnIndex)\n            throws SQLException {\n        return convertToAddress(cs.getString(columnIndex));\n    }\n}\n```\n\n\u6d4b\u8bd5\u6570\u636e\u5982\u4e0b\uff1a\n\n```sql\ncreate table user (\n  id integer NOT NULL PRIMARY KEY,\n  name varchar(32),\n  address varchar(64),\n  state integer\n);\n\nINSERT INTO user (id, name, address, state) VALUES (1, 'abel533', 'Hebei/Shijiazhuang', 1);\nINSERT INTO user (id, name, address, state) VALUES (2, 'isea533', 'Hebei/Handan', 0);\n```\n\n\u003E \u7279\u522b\u6ce8\u610f\uff0cstate \u5bf9\u5e94\u7684 0 \u5c31\u662f\u679a\u4e3e\u7b2c\u4e00\u4e2a disabled\uff0c1 \u5c31\u662f\u679a\u4e3e\u7b2c\u4e8c\u4e2a enabled\u3002\n\n#### 7.2.1 \u4f7f\u7528 ColumnType \u6ce8\u89e3\u6307\u5b9a\n\n\u521b\u5efa user \u8868\u5bf9\u5e94\u7684 User \u5b9e\u4f53\uff1a\n\n```java\npublic class User implements Serializable {\n    private static final long serialVersionUID = 1L;\n    @Id\n    private Integer   id;\n    private String    name;\n    @ColumnType(typeHandler = AddressTypeHandler.class)\n    private Address   address;\n    private StateEnum state;\n\n    //\u7701\u7565 setter \u548c getter\n}\n```\n\n\u003E **\u7279\u522b\u63d0\u9192**\n\u003E\n\u003E 1. \u9ed8\u8ba4\u60c5\u51b5\u4e0b\u53ea\u6709\u7b80\u5355\u7c7b\u578b\u624d\u4f1a\u88ab\u5f53\u4f5c\u8868\u4e2d\u7684\u5b57\u6bb5(`useSimpleType=true`)\u3002\n\u003E 2. \u5f53\u5b57\u6bb5\u6709 `@Column` \u6216\u8005 `@ColumnType` \u6ce8\u89e3\u65f6\uff0c\u4e5f\u4f1a\u88ab\u5f53\u4f5c\u8868\u4e2d\u7684\u5b57\u6bb5\u3002\n\u003E 3. \u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u679a\u4e3e\u4e0d\u4f1a\u5f53\u4f5c\u8868\u4e2d\u7684\u5b57\u6bb5\uff0c\u5982\u679c\u60f3\u8981\u81ea\u52a8\u628a\u679a\u4e3e\u4f5c\u4e3a\u8868\u4e2d\u5b57\u6bb5\uff0c\u9700\u8981\u914d\u7f6e `enumAsSimpleType=true`\uff0c**\u8fd9\u91cc\u7684\u4f8b\u5b50\u5c31\u542f\u7528\u4e86\u8fd9\u4e2a\u914d\u7f6e**\u3002\u5982\u679c\u4e0d\u542f\u7528\u8fd9\u4e2a\u529f\u80fd\uff0c\u4e5f\u9700\u8981\u52a0  `@Column` \u6216\u8005 `@ColumnType` \u6ce8\u89e3\u3002\n\n\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c`address` \u5b57\u6bb5\u901a\u8fc7 `@ColumnType` \u8bbe\u7f6e\u4e86 `typeHandler`\u3002\u4f46\u662f `state` \u5374\u6ca1\u8fd9\u4e48\u8bbe\u7f6e\uff0c\u5148\u770b `EnumOrdinalTypeHandler` \u7684\u5b9a\u4e49\uff1a\n\n```java\npublic class EnumOrdinalTypeHandler\u003CE extends Enum\u003CE\u003E\u003E extends BaseTypeHandler\u003CE\u003E\n```\n\n\u7531\u4e8e\u9700\u8981\u6307\u5b9a\u6cdb\u578b\uff0c\u56e0\u6b64\u8fd9\u91cc\u4e0d\u80fd\u76f4\u63a5\u914d\u7f6e\uff0c\u9664\u975e\u4f60\u5728\u521b\u5efa\u4e00\u4e2a\u9488\u5bf9\u6027\u7684 TypeHandler\uff0c\u4f8b\u5982\uff1a\n\n```java\npublic class StateEnumTypeHandler extends EnumOrdinalTypeHandler\u003CStateEnum\u003E {\n    public StateEnumTypeHandler(Class\u003CStateEnum\u003E type) {\n        super(type);\n    }\n}\n```\n\n\u7136\u540e\u914d\u7f6e\uff1a\n\n```java\n@ColumnType(typeHandler = StateEnumTypeHandler.class)\nprivate StateEnum state;\n```\n\n\u9664\u4e86\u7528\u8fd9\u79cd\u9ebb\u70e6\u7684\u65b9\u5f0f\u5916\uff0c\u8fd8\u53ef\u4ee5\u76f4\u63a5\u7528\u4e0b\u9762\u7684\u65b9\u5f0f\u914d\u7f6e\u5168\u5c40\u7684 typeHandler\uff1a\n\n```xml\n\u003C!DOCTYPE configuration\n        PUBLIC \"-//mybatis.org//DTD Config 3.0//EN\"\n        \"http://mybatis.org/dtd/mybatis-3-config.dtd\"\u003E\n\n\u003Cconfiguration\u003E\n    \u003C!-- \u5176\u4ed6\u914d\u7f6e --\u003E\n    \u003CtypeHandlers\u003E\n        \u003CtypeHandler \n                handler=\"org.apache.ibatis.type.EnumOrdinalTypeHandler\" \n                javaType=\"tk.mybatis.mapper.typehandler.StateEnum\"/\u003E\n    \u003C/typeHandlers\u003E\n    \u003C!-- \u5176\u4ed6\u914d\u7f6e --\u003E\n\u003C/configuration\u003E\n```\n\n\u6709\u4e86\u8fd9\u4e9b\u914d\u7f6e\u540e\uff0c\u5c31\u53ef\u4ee5\u5728\u589e\u5220\u6539\u67e5\u4f7f\u7528\u4e86\u3002\n\n\u8fd9\u4e2a\u4f8b\u5b50\u5bf9\u5e94\u7684\u6d4b\u8bd5\uff1a [`tk.mybatis.mapper.typehandler.TypeHandlerTest`](https://github.com/abel533/Mapper/blob/master/base/src/test/java/tk/mybatis/mapper/typehandler/TypeHandlerTest.java)\u3002\n\n#### 7.2.2 \u5168\u5c40\u914d\u7f6e\n\n\u7b2c\u4e8c\u79cd\u5c31\u662f\u5168\u90e8\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u4f7f\u7528 typeHandler \u8fdb\u884c\u914d\u7f6e\uff0c\u5b9e\u4f53\u53ea\u505a\u7b80\u5355\u7684\u914d\u7f6e\uff1a\n\n```java\n@Table(name = \"user\")\npublic class User2 implements Serializable {\n    private static final long serialVersionUID = 1L;\n    @Id\n    private Integer   id;\n    private String    name;\n    @Column\n    private Address   address;\n    private StateEnum state;\n\n    //\u7701\u7565 setter \u548c getter\n}\n```\n\n\u8fd9\u91cc\u7684 `Address` \u52a0\u4e0a `@Column` \u6ce8\u89e3\uff0c\u53ea\u662f\u4e3a\u4e86\u628a\u8be5\u5b57\u6bb5\u5f53\u6210\u8868\u4e2d\u7684\u5b57\u6bb5\u3002\n\ntypeHandler \u5168\u5c40\u914d\u7f6e\u5982\u4e0b\uff1a\n\n```xml\n\u003CtypeHandlers\u003E\n    \u003CtypeHandler \n                 handler=\"org.apache.ibatis.type.EnumOrdinalTypeHandler\" \n                 javaType=\"tk.mybatis.mapper.typehandler.StateEnum\"/\u003E\n    \n    \u003CtypeHandler handler=\"tk.mybatis.mapper.typehandler.AddressTypeHandler\"/\u003E\n\u003C/typeHandlers\u003E\n```\n\n\u505a\u597d\u8fd9\u4e9b\u914d\u7f6e\u540e\uff0c\u5c31\u53ef\u4ee5\u5728\u589e\u5220\u6539\u67e5\u4f7f\u7528\u4e86\u3002\n\n\u8fd9\u4e2a\u4f8b\u5b50\u5bf9\u5e94\u7684\u6d4b\u8bd5\uff1a [`tk.mybatis.mapper.typehandler.TypeHandlerTest2`](https://github.com/abel533/Mapper/blob/master/base/src/test/java/tk/mybatis/mapper/typehandler/TypeHandlerTest2.java)\u3002"},{"id":"Home","pId":0,"name":"Home","parent":null,"order":0,"sort_id":14104,"extname":".md","isHidden":false,"content":"# MyBatis \u901a\u7528 Mapper4\n\n[![Build Status](https://travis-ci.org/abel533/Mapper.svg?branch=master)](https://travis-ci.org/abel533/Mapper)\n[![Maven central](https://maven-badges.herokuapp.com/maven-central/tk.mybatis/mapper/badge.svg)](https://maven-badges.herokuapp.com/maven-central/tk.mybatis/mapper)\n[![Dependency Status](https://www.versioneye.com/user/projects/593212c722f278006540a1d1/badge.svg?style=flat)](https://www.versioneye.com/user/projects/593212c722f278006540a1d1)\n\n\u901a\u7528 Mapper4 \u662f\u4e00\u4e2a\u53ef\u4ee5\u5b9e\u73b0\u4efb\u610f MyBatis \u901a\u7528\u65b9\u6cd5\u7684\u6846\u67b6\uff0c\u9879\u76ee\u63d0\u4f9b\u4e86\u5e38\u89c4\u7684\u589e\u5220\u6539\u67e5\u64cd\u4f5c\u4ee5\u53ca`Example` \u76f8\u5173\u7684\u5355\u8868\u64cd\u4f5c\u3002\u901a\u7528 Mapper \u662f\u4e3a\u4e86\u89e3\u51b3 MyBatis \u4f7f\u7528\u4e2d 90% \u7684\u57fa\u672c\u64cd\u4f5c\uff0c\u4f7f\u7528\u5b83\u53ef\u4ee5\u5f88\u65b9\u4fbf\u7684\u8fdb\u884c\u5f00\u53d1\uff0c\u53ef\u4ee5\u8282\u7701\u5f00\u53d1\u4eba\u5458\u5927\u91cf\u7684\u65f6\u95f4\u3002\n\n## \u901a\u7528 Mapper 4 \u548c 3 \u7684\u533a\u522b\n\n1.  \u6700\u5927\u7684\u533a\u522b\u5c31\u662f mapper4 \u628a mapper3 \u62c6\u6210\u4e86 base, core, extra,generator, spring 5\u4e2a\u9879\u76ee\uff0c\u5e76\u4e14\u628a weekend \u548c spring-boot-starter \u4e24\u4e2a\u9879\u76ee\u4e5f\u52a0\u5165\u8fdb\u6765\u3002\n2.  Mapper 4 \u9ed8\u8ba4\u4e0d\u9700\u8981\u4efb\u4f55\u914d\u7f6e\uff0c\u81ea\u52a8\u6ce8\u518c\u63a5\u53e3\uff08\u4e0d\u9700\u8981 `mappers` \u53c2\u6570\uff09\uff0c\u9700\u8981\u57fa\u7c7b\u63a5\u53e3\u6807\u8bb0 `@RegisterMapper` \u6ce8\u89e3\u3002\n3.  \u5728\u5e38\u89c4\u7528\u6cd5\u4e2d\uff0c\u8fd8\u53ef\u4ee5\u76f4\u63a5\u5f15\u5165 `tk.mybatis:mapper:\u7248\u672c\u53f7`\uff0c\u5347\u7ea7\u7248\u672c\u5373\u53ef\u3002\n4.  \u62c6\u5206\u9879\u76ee\u540e\uff0c\u9664\u4e86\u7b2c 3 \u6761\u7684\u5e38\u89c4\u65b9\u6cd5\u5916\uff0c\u8fd8\u53ef\u4ee5\u6309\u9700\u914d\u7f6e\u4f9d\u8d56\uff0c\u6838\u5fc3\u53ea\u9700\u8981\u4e00\u4e2a `core`\uff0c\u5176\u4ed6\u7684\u90fd\u662f\u5728\u6b64\u57fa\u7840\u4e0a\u8fdb\u884c\u7684\u6269\u5c55\u3001\u65b9\u6cd5\u5b9e\u73b0\u6216\u8005\u96c6\u6210\u3002\n5.  \u548c spring \u96c6\u6210\u7684\u66f4\u5f7b\u5e95\uff0c\u4e0d\u4f1a\u51fa\u73b0\u4ee5\u524d\u7684\u4e00\u4e9b\u5e38\u89c1\u95ee\u9898\u3002\n\n## \u4f7f\u7528\u6587\u6863\n\n\u521d\u6b21\u4f7f\u7528\u65f6\uff0c\u8bf7\u6309\u7167\u4e0b\u9762\u7684\u6587\u6863\u987a\u5e8f\u4f9d\u6b21\u9605\u8bfb\uff0c\u4f7f\u7528\u4e2d\u9047\u5230\u7684\u95ee\u9898\u65f6\uff0c\u53ef\u4ee5\u53c2\u8003\u76f8\u5e94\u7684\u6587\u6863\u6765\u67e5\u770b\u3002\n\n1.  [\u96c6\u6210\u901a\u7528 Mapper](1.integration)\n    -  [1.1 Java \u7f16\u7801\u65b9\u5f0f](1.1-java)\n    -  [1.2 \u548c Spring \u96c6\u6210](1.2-spring)\n    -  [1.3 \u548c Spring Boot \u96c6\u6210](1.3-spring-boot)\n2.  [\u5bf9\u8c61\u5173\u7cfb\u6620\u5c04](2.orm)\n    -  [2.1 \u7b80\u5355\u793a\u4f8b](2.1-simple)\n    -  [2.2 \u6570\u636e\u5e93\u6620\u5c04](2.2-mapping)\n    -  [2.3 \u4e3b\u952e\u7b56\u7565](2.3-generatedvalue)\n    -  [2.4 \u4e50\u89c2\u9501](2.4-version)\n3.  [\u914d\u7f6e\u4ecb\u7ecd](3.config)\n4.  [\u4ee3\u7801\u751f\u6210\u5668](4.generator)\n5.  [\u6269\u5c55\u901a\u7528\u63a5\u53e3](5.extend)\n6.  [Example \u7528\u6cd5](6.example)\n7.  \u5176\u4ed6\u914d\u7f6e\u548c\u7528\u6cd5\n    - [7.1 \u4e8c\u7ea7\u7f13\u5b58\u914d\u7f6e](7.1.cache)\n    - [7.2 TypeHandler \u7528\u6cd5](7.2.typehandler)\n8.  [\u5e38\u89c1\u95ee\u9898](faq)\n9.  [\u66f4\u65b0\u65e5\u5fd7](changelog)\n\n## \u6350\u8d60\n\n\u9879\u76ee\u7684\u53d1\u5c55\u79bb\u4e0d\u5f00\u4f60\u7684\u652f\u6301\uff0c\u8bf7\u4f5c\u8005\u559d\u676f\u5496\u5561\u5427\uff01\n\n\u652f\u4ed8\u5b9d\n\n![\u652f\u4ed8\u5b9d](http://mybatis.tk/images/alipay.png)\n\n\u5fae\u4fe1\n\n![\u5fae\u4fe1](http://mybatis.tk/images/weixinpay.png)\n\n## \u60f3\u8981\u83b7\u53d6\u8be5\u9879\u76ee\u6700\u65b0\u6d88\u606f\uff0c\u53ef\u4ee5\u5173\u6ce8\u4e0b\u65b9\u516c\u4f17\u53f7\n\n![\u5fae\u4fe1\u516c\u4f17\u53f7](http://mybatis.tk/images/wxgzh.jpg)"},{"id":"_Footer","pId":0,"name":"_Footer","parent":null,"order":0,"sort_id":208216,"extname":".md","isHidden":false,"content":"[1. \u96c6\u6210\u901a\u7528 Mapper](1.integration)  ||  [2. \u5bf9\u8c61\u5173\u7cfb\u6620\u5c04](2.orm)  ||  [3. \u914d\u7f6e\u4ecb\u7ecd](3.config)"},{"id":"_Sidebar","pId":0,"name":"_Sidebar","parent":null,"order":0,"sort_id":208217,"extname":".md","isHidden":false,"content":"1.  [\u96c6\u6210\u901a\u7528 Mapper](1.integration)\n    -  [1.1 Java \u7f16\u7801\u65b9\u5f0f](1.1-java)\n    -  [1.2 \u548c Spring \u96c6\u6210](1.2-spring)\n    -  [1.3 \u548c Spring Boot \u96c6\u6210](1.3-spring-boot)\n2.  [\u5bf9\u8c61\u5173\u7cfb\u6620\u5c04](2.orm)\n    -  [2.1 \u7b80\u5355\u793a\u4f8b](2.1-simple)\n    -  [2.2 \u6570\u636e\u5e93\u6620\u5c04](2.2-mapping)\n    -  [2.3 \u4e3b\u952e\u7b56\u7565](2.3-generatedvalue)\n    -  [2.4 \u4e50\u89c2\u9501](2.4-version)\n3.  [\u914d\u7f6e\u4ecb\u7ecd](3.config)\n4.  [\u4ee3\u7801\u751f\u6210\u5668](4.generator)\n5.  [\u6269\u5c55\u901a\u7528\u63a5\u53e3](5.extend)\n6.  [Example \u7528\u6cd5](6.example)\n7.  \u5176\u4ed6\u914d\u7f6e\u548c\u7528\u6cd5\n    - [7.1 \u4e8c\u7ea7\u7f13\u5b58\u914d\u7f6e](7.1.cache)\n    - [7.2 TypeHandler \u7528\u6cd5](7.2.typehandler)\n8.  [\u5e38\u89c1\u95ee\u9898](faq)\n9.  [\u66f4\u65b0\u65e5\u5fd7](changelog)"},{"id":"changelog","pId":0,"name":"changelog","parent":null,"order":0,"sort_id":219372,"extname":".md","isHidden":false,"content":"# \u66f4\u65b0\u65e5\u5fd7\n\n## 3.5.2 - 2018-01-24\n\n#### 1. `delete` \u548c `deleteByPrimaryKey` \u589e\u52a0\u5bf9\u4e50\u89c2\u9501\u6ce8\u89e3 `@Version` \u7684\u652f\u6301\u3002\n\n\u6d4b\u8bd5\u7528\u4f8b\u5982\u4e0b\uff1a\n```java\n/**\n * \u4e50\u89c2\u9501\u5220\u9664\n */\n@Test\npublic void testDeleteByPrimaryKeyAndVersion() {\n    SqlSession sqlSession = MybatisHelper.getSqlSession();\n    try {\n        CountryVersionMapper mapper = sqlSession.getMapper(CountryVersionMapper.class);\n        //\u6839\u636e\u4e3b\u952e\u5220\u9664\uff0c\u6ca1\u6709\u6307\u5b9a\u7248\u672c\u65f6\u5220\u9664\u4e0d\u4e86\n        Assert.assertEquals(0, mapper.deleteByPrimaryKey(100));\n\n        CountryVersion countryVersion = new CountryVersion();\n        countryVersion.setId(100);\n        countryVersion.setVersion(2);\n        //\u7248\u672c\u4e0d\u5bf9\u7684\u65f6\u5019\u7684\u65f6\u5019\u5220\u9664\u4e0d\u4e86\n        Assert.assertEquals(0, mapper.deleteByPrimaryKey(countryVersion));\n\n        countryVersion.setId(100);\n        countryVersion.setVersion(1);\n        //\u7248\u672c\u6b63\u786e\u7684\u65f6\u5019\u53ef\u4ee5\u771f\u6b63\u5220\u9664\n        Assert.assertEquals(1, mapper.deleteByPrimaryKey(countryVersion));\n    } finally {\n        sqlSession.rollback();\n        sqlSession.close();\n    }\n}\n```\n\u65e5\u5fd7\u5982\u4e0b\uff1a\n```\nDEBUG [main] - ==\u003E  Preparing: DELETE FROM country WHERE id = ? AND version = ? \nDEBUG [main] - ==\u003E Parameters: 100(Integer), 100(Integer)\nDEBUG [main] - \u003C==    Updates: 0\nDEBUG [main] - ==\u003E  Preparing: DELETE FROM country WHERE id = ? AND version = ? \nDEBUG [main] - ==\u003E Parameters: 100(Integer), 2(Integer)\nDEBUG [main] - \u003C==    Updates: 0\nDEBUG [main] - ==\u003E  Preparing: DELETE FROM country WHERE id = ? AND version = ? \nDEBUG [main] - ==\u003E Parameters: 100(Integer), 1(Integer)\nDEBUG [main] - \u003C==    Updates: 1\n```\n**\u7279\u522b\u6ce8\u610f\uff1a** \u4e0a\u9762\u6d4b\u8bd5\u7528\u4f8b\u5df2\u7ecf\u5c55\u793a\u4e86\u589e\u52a0\u4e50\u89c2\u9501\u540e\u7684\u53c2\u6570\u5982\u4f55\u4f20\u9012\uff0c\u5f53\u4e3b\u952e\u591a\u4e2a\u503c\u6216\u8005\u4f7f\u7528\u4e50\u89c2\u9501\u7684\u65f6\u5019\u5c31\u9700\u8981\u901a\u8fc7\u5b9e\u4f53\uff08Map\u4e5f\u53ef\u4ee5\uff09\u4f20\u9012\u591a\u4e2a\u53c2\u6570\u503c\u3002\u548c\u4e4b\u524d\u7684 update \u4e00\u6837\uff0c\u9700\u8981\u81ea\u5df1\u5bf9\u6267\u884c\u7ed3\u679c\u8fdb\u884c\u5224\u65ad\u6765\u5224\u65ad\u662f\u5426\u6267\u884c\u6210\u529f\u3002\n\n#### 2. 3.5.0 \u7248\u672c\u4e2d\u7684\u53c2\u6570 `annotationAsSimpleType` \u540d\u5b57\u9519\u4e86\uff0c\u73b0\u5728\u6539\u4e3a `enumAsSimpleType`\uff0c\u7528\u4e8e\u914d\u7f6e\u662f\u5426\u5c06\u679a\u4e3e\u7c7b\u578b\u5f53\u6210\u57fa\u672c\u7c7b\u578b\u5bf9\u5f85\u3002\n\n#### 3. `SimpleTypeUtil` \u589e\u52a0\u5bf9 java8 \u4e2d\u7684\u65e5\u671f\u7c7b\u578b\u7684\u652f\u6301\u3002\n\n#### 4. `Example.Builder` \u589e\u52a0\u7c7b\u4f3c `Weekend` \u4e2d Java8 \u65b9\u6cd5\u5f15\u7528\u7684\u7528\u6cd5\uff0c\u8be5\u529f\u80fd\u7531 [chinaerserver](https://github.com/chinaerserver) \u63d0\u4ea4([#pr207](https://github.com/abel533/Mapper/pull/207))\n\n\u793a\u4f8b\u5982\u4e0b\uff1a\n```java\n@Test\npublic void testWeekend() {\n    SqlSession sqlSession = MybatisHelper.getSqlSession();\n    try {\n        CountryMapper mapper = sqlSession.getMapper(CountryMapper.class);\n        //\u666e\u901a\u65b9\u5f0f\n        List\u003CCountry\u003E selectByExample = mapper.selectByExample(\n                new Example.Builder(Country.class).where(Sqls.custom().andLike(\"countryname\", \"China\")).build());\n        //Java8 \u65b9\u5f0f\n        List\u003CCountry\u003E selectByWeekendSql = mapper.selectByExample(new Example.Builder(Country.class)\n                .where(WeekendSqls.\u003CCountry\u003Ecustom().andLike(Country::getCountryname, \"China\")).build());\n        // \u5224\u65ad\u4e24\u4e2a\u7ed3\u679c\u6570\u7ec4\u5185\u5bb9\u662f\u5426\u76f8\u540c\n        Assert.assertArrayEquals(selectByExample.toArray(), selectByWeekendSql.toArray());\n    } finally {\n        sqlSession.close();\n    }\n}\n```\n\n#### 5. \u5f53\u9879\u76ee\u4e2d\u4f7f\u7528\u4e86\u81ea\u5b9a\u4e49classloader\u7684\u65f6\u5019\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6eclassloader\u4e0a\u4e0b\u6587\u7684\u65b9\u5f0f\u6765\u4f7f\u5f97\u81ea\u5df1\u7684mapper class\u80fd\u591f\u88ab\u627e\u5230(\u8fd9\u91cc\u7684\u4fee\u6539\u53c2\u7167\u4e86 mybatis \u6e90\u7801\u4e2d\u7684 ClassLoaderWrapper \u7c7b)\uff0cby [liyongjun1](https://github.com/liyongjun1) [#pr185](https://github.com/abel533/Mapper/pull/185)\n\n#### 6. \u91cd\u70b9\u63d0\u9192\uff0c3.5.0 \u4e2d `useSimpleType` \u9ed8\u8ba4\u503c\u6539\u4e3a `true`\uff0c\u9ed8\u8ba4\u5ffd\u7565\u590d\u6742\u7c7b\u578b\u7684\u5b57\u6bb5\uff0c\u590d\u6742\u7c7b\u578b\u4e0d\u9700\u8981\u52a0 `@Transient` \u6ce8\u89e3\uff0c\u5177\u4f53\u7c7b\u578b\u53ef\u4ee5\u53c2\u8003 `SimpleTypeUtil` \u7c7b\u3002\n\n\u5728 `SimpleTypeUtil` \u7c7b\u4e2d\uff0c\u7531\u4e8e\u4e00\u822c\u7684 JavaBean \uff08\u5c24\u5176\u662f MyBatis\uff09\u89c4\u8303\u4e2d\uff0c\u4e0d\u80fd\u4f7f\u7528\u57fa\u672c\u7c7b\u578b\uff0c\u8fd9\u4e3b\u8981\u662f\u7531\u4e8e\u57fa\u672c\u7c7b\u578b\u6709\u9ed8\u8ba4\u503c\uff0c\u5728\u4e00\u4e9b\u52a8\u6001 SQL \u60c5\u51b5\u4e0b\uff08\u5982\u6240\u6709 Selective \u65b9\u6cd5\uff09\uff0c\u65e0\u6cd5\u5224\u65ad\u57fa\u672c\u7c7b\u578b\u7684\u503c\u662f\u4e0d\u662f `null`\u3002\n\u6240\u4ee5\u5728\u8fd9\u91cc\u7684\u7b80\u5355\u7c7b\u578b\u662f\u4e0d\u5305\u542b `byte,short,int,long,float,double,char,boolean` \u8fd9\u516b\u79cd\u57fa\u672c\u7c7b\u578b\u7684\u3002\n\n\u5982\u679c\u4f60\u8981\u5347\u7ea7\u901a\u7528 Mapper \u4f46\u662f\u4e0d\u60f3\u4fee\u6539\u539f\u6765\u7684\u57fa\u672c\u7c7b\u578b\uff0c\u5c31\u8bbe\u7f6e `useSimpleType=false`\u3002\n\n## 3.5.0 - 2018-01-08\n\n- \u517c\u5bb9 mbg 1.3.6 \u7248\u672c\u3002\n- `EntityColumn` \u8bb0\u5f55 `EntityField` \u4fe1\u606f\uff0c\u65b9\u4fbf\u540e\u7eed\u6269\u5c55\u4f7f\u7528\u3002\n- \u9488\u5bf9 update \u4e24\u4e2a\u57fa\u672c\u65b9\u6cd5\u589e\u52a0\u4e50\u89c2\u9501\u529f\u80fd\uff0c\u5728\u5b9e\u4f53\u7c7b\u5bf9\u7248\u672c\u5b57\u6bb5\u589e\u52a0 `@Version` \u6ce8\u89e3\u5373\u53ef\uff0c\u9ed8\u8ba4\u652f\u6301 `Integer` \u548c `Long` \u7c7b\u578b\uff0c\u5176\u4ed6\u60c5\u51b5\u53ef\u4ee5\u5b9e\u73b0 `NextVersion` \u63a5\u53e3\u5e76\u5728\u6ce8\u89e3\u4e2d\u6307\u5b9a\u8be5\u5b9e\u73b0\uff0c\u4e00\u4e2a\u5b9e\u4f53\u7c7b\u4e2d\u6700\u591a\u53ea\u80fd\u6709\u4e00\u4e2a\u52a0 `@Version` \u6ce8\u89e3\u7684\u5b57\u6bb5\u3002\n\n- 3.4.0\u589e\u52a0\u7684 `useSimpleType` \u9ed8\u8ba4\u503c\u6539\u4e3a `true`\uff0c\u9ed8\u8ba4\u5ffd\u7565\u590d\u6742\u7c7b\u578b\u7684\u5b57\u6bb5\uff0c\u590d\u6742\u7c7b\u578b\u4e0d\u9700\u8981\u52a0 `@Transient` \u6ce8\u89e3\uff0c\u5177\u4f53\u7c7b\u578b\u53ef\u4ee5\u53c2\u8003 `SimpleTypeUtil` \u7c7b\u3002\n- \u65b0\u589e `annotationAsSimpleType` \u53c2\u6570\uff0c\u9ed8\u8ba4 `false`\uff0c\u8bbe\u7f6e\u4e3a `true` \u540e\u4f1a\u628a\u679a\u4e3e\u4f5c\u4e3a\u7b80\u5355\u7c7b\u578b\u5bf9\u5f85\uff0c\u9700\u8981\u914d\u5408 `useSimpleType = true` \u4f7f\u7528\u3002\n- \u65b0\u589e `wrapKeyword` \u53c2\u6570\uff0c\u914d\u7f6e\u540e\u4f1a\u81ea\u52a8\u5904\u7406\u5173\u952e\u5b57\uff0c\u53ef\u4ee5\u914d\u7684\u503c\u548c\u6570\u636e\u5e93\u6709\u5173\uff0c\u4f8b\u5982 sqlserver \u53ef\u4ee5\u914d\u7f6e\u4e3a `[{0}]`\uff0c\u4f7f\u7528 `{0}` \u66ff\u4ee3\u539f\u6765\u7684\u5217\u540d\u3002\n- `FieldHelper` \u6539\u4e3a\u5224\u65ad\u5f53\u524djdk\u7248\u672c\u662f\u5426\u4e3a6\u548c7\uff0c\u5176\u4ed6\u60c5\u51b5\u6309jdk8\u5904\u7406\uff0c\u56e0\u6b64\u652f\u6301jdk9+\n\n- \u65b0\u589e `selectOneByExample` \u65b9\u6cd5\uff0c\u5fc5\u987b\u4fdd\u8bc1\u8fd4\u56de\u503c\u6700\u591a 1 \u4e2a\uff0c\u5426\u5219\u629b\u51fa\u5f02\u5e38\u3002\n- \u589e\u52a0\u65b0\u7684 `tk.mybatis.mapper.additional.insert.InsertListMapper`\uff0c\u8fd9\u4e2a\u6279\u91cf\u63d2\u5165\u65b9\u6cd5\u4e0d\u652f\u6301\u4e3b\u952e\u7b56\u7565\uff0c\u4e0d\u4f1a\u8fd4\u56de\u81ea\u52a8\u751f\u6210\u7684\u4e3b\u952e\n\n\u4f7f\u7528 `@Version` \u6ce8\u89e3\u7684\u6548\u679c\u5982\u4e0b\uff1a\n\n```sql\nDEBUG [main] - ==\u003E  Preparing: UPDATE country SET countryname = ?,countrycode = ?,version = 2 WHERE id = ? AND version = ? \nDEBUG [main] - ==\u003E Parameters: \u7f8e\u56fd2(String), US(String), 174(Integer), 1(Integer)\n```\n\n\u81ea\u52a8\u5904\u7406\u5173\u952e\u5b57\u4ee3\u7801\uff1a\n```java\n//\u81ea\u52a8\u5904\u7406\u5173\u952e\u5b57\nif (StringUtil.isNotEmpty(wrapKeyword) \u0026\u0026 SqlReservedWords.containsWord(columnName)) {\n    columnName = MessageFormat.format(wrapKeyword, columnName);\n}\n```\n\n## 3.4.6 - 2017-12-17\n\n- `Example` \u65b0\u589e builder \u6a21\u5f0f\uff08by [Ngone51](https://github.com/abel533/Mapper/commits?author=Ngone51)\uff09\u3002\n- \u8bbe\u7f6e\u4e0b\u5212\u7ebf\u98ce\u683c\u66ff\u6362\u4e3a\u9a7c\u5cf0\u98ce\u683c\u7684Pattern\u4e3aStringUtil\u7684\u9759\u6001\u53d8\u91cf\uff08by [Ngone51](https://github.com/abel533/Mapper/commits?author=Ngone51)\uff09\u3002\n\n\u4e00\u4e2a\u7b80\u5355\u7684 builder \u7528\u6cd5\u793a\u4f8b\uff1a\n```java\n/*\n *   @description: \u591a\u4e2awhere\u8fde\u63a5\u7684\u67e5\u8be2\u8bed\u53e5\u6d4b\u8bd5\n *\n */\n@Test\npublic void testWhereAndWhereCompound() {\n    SqlSession sqlSession = MybatisHelper.getSqlSession();\n    try {\n        CountryMapper mapper = sqlSession.getMapper(CountryMapper.class);\n        Example example = Example.builder(Country.class)\n                .where(Sqls.custom()\n                    .andEqualTo(\"countryname\", \"China\")\n                    .andEqualTo(\"id\", 35)\n                )\n                .andWhere(Sqls.custom()\n                    .andEqualTo(\"id\", 183)\n                )\n                .build();\n        List\u003CCountry\u003E countries = mapper.selectByExample(example);\n        Assert.assertEquals(0, countries.size());\n\n    } finally {\n        sqlSession.close();\n    }\n}\n```\n\u66f4\u591a\u7528\u6cd5\u53ef\u4ee5\u901a\u8fc7\u6d4b\u8bd5 [`TestExampleBuilder`](https://github.com/abel533/Mapper/blob/master/src/test/java/tk/mybatis/mapper/test/example/TestExampleBuilder.java) \u4e86\u89e3\u3002\n\n## 3.4.5 - 2017-11-11\n\n- \u63d2\u4ef6\u589e\u52a0\u4e00\u4e2a `\u003Ccontext\u003E` \u5c5e\u6027\u914d\u7f6e\uff0c\u53ef\u4ee5\u63a7\u5236\u662f\u5426\u4f7f\u7528\u901a\u7528 Mapper \u81ea\u5e26\u7684 `MapperCommentGenerator`\uff0c\u7528\u6cd5\u5982\u4e0b\uff1a\n```xml\n\u003CgeneratorConfiguration\u003E\n  \u003Ccontext id=\"Mysql\" targetRuntime=\"MyBatis3Simple\" defaultModelType=\"flat\"\u003E\n    \u003C!--\u65b0\u589e\u7684\u53c2\u6570\uff0c\u9ed8\u8ba4true \u4f7f\u7528--\u003E\n    \u003Cproperty name=\"useMapperCommentGenerator\" value=\"false\"/\u003E\n    \u003C!-- \u5176\u4ed6 --\u003E\n  \u003C/context\u003E\n\u003C/generatorConfiguration\u003E\n```\n- \u589e\u52a0\u57fa\u4e8e MBG \u7684\u4ee3\u7801\u751f\u6210\u5668\u63d2\u4ef6\uff0c\u53c2\u8003[\u4f7f\u7528\u6587\u6863](https://github.com/abel533/Mapper/blob/master/wiki/mapper3/11.CodeGenerator.md)\u3002\n\n## 3.4.4 - 2017-10-19\n\n* \u589e\u52a0 mapper-weekend\uff08\u4f5c\u8005 [liuyuyu](https://github.com/liuyuyu)\uff09\uff0c\u652f\u6301jdk8\u51fd\u6570\u5f0f\u5f15\u7528\u65b9\u6cd5\uff0c\u7528\u6cd5\u5982\u4e0b\uff1a\n\n```java\n  UserMapper    userMapper = sqlSession.getMapper(UserMapper.class);\n  Weekend\u003CUser\u003E weekend    = Weekend.of(User.class);\n  weekend.weekendCriteria()\n          .andIsNull(User::getId)\n          .andBetween(User::getId,0,10)\n          .andIn(User::getUserName, Arrays.asList(\"a\",\"b\",\"c\"));\n```\n\n\u003E\u53ef\u4ee5\u5728 `Example.Criteria` \u7684\u6761\u4ef6\u65b9\u6cd5\u91cc\u4f20 lambada(\u518d\u4e5f\u4e0d\u7528\u62c5\u5fc3\u6539\u6570\u636e\u5e93\u4e86......)\u3002\n\n\u540e\u7eed\u4f1a\u7ee7\u7eed\u5728 3.x \u7248\u672c\u66f4\u65b0\u548c\u7ef4\u62a4\u3002\n\n\u539f\u6765\u8ba1\u5212\u7684 4.0 \u7248\u672c\u6253\u7b97\u7528 mybatis \u66f4\u539f\u751f\u7684\u65b9\u5f0f\u5b9e\u73b0\uff0c\u6240\u4ee5\u9700\u8981\u5c3d\u5feb\u914d\u5408\u5b98\u65b9\u5408\u5e76\u4e00\u4e2a\u65b0\u529f\u80fd\uff0c\u53ea\u6709\u7b49\u5408\u5e76\u540e\u624d\u4f1a\u5f00\u59cb 4.0 \u7684\u5f00\u53d1\u3002\n\n## 3.4.3 - 2017-08-17\n\n* `MapperPlugin` \u589e\u52a0 `forceAnnotation` \u53c2\u6570\uff0c\u9ed8\u8ba4 `false`\uff0c\u8bbe\u7f6e\u4e3a `true` \u540e\u4e00\u5b9a\u4f1a\u751f\u6210`@Table`\u548c`@Column`\u6ce8\u89e3\u3002\n* \u4e3a\u5b9e\u4f8b\u5316 `TypeHandler` \u589e\u52a0 `javaTypeClass` by **junchao**\u3002\n* \u66f4\u65b0 `Example` \u7c7b\uff0c\u5728\u83b7\u53d6 `property` \u65f6\uff0c\u5224\u65ad\u6709\u6ca1\u6709\u8be5 `property` \u5e76\u629b\u51fa\u5f02\u5e38 by **chengcheng.feng**\u3002\n* \u6240\u6709\u7c7b\u7684\u5c5e\u6027\u4ece `HashMap` \u6539\u4e3a `ConcurrentHashMap`\u3002\n\n\n## 3.4.2 - 2017-07-19\n\n* \u7b80\u5316Example\u7684xml\u903b\u8f91\uff0c\u89e3\u51b3\u7531\u4e8eand,or\u4f4d\u7f6e\u9519\u8bef\u5bfc\u81f4Example\u4f7f\u7528\u7a7a\u6761\u4ef6\u65f6\u7684\u9519\u8bef\uff0c\u5b8c\u5584\u6d4b\u8bd5\n\n## 3.4.1 - 2017-07-17\n\n* `Example` \u589e\u52a0\u590d\u6742\u7684 `and` \u548c `or` \u529f\u80fd\u3002\n* `Example` \u589e\u52a0\u6392\u9664\u67e5\u8be2\u5b57\u6bb5\u7684\u65b9\u6cd5 `excludeProperties`(`selectProperties`\u4f18\u5148\u7ea7\u66f4\u9ad8) [#261](http://git.oschina.net/free/Mapper/issues/261).\n* `SqlHelper` \u4e2d\u590d\u6742\u7684 `if` \u6539\u4e3a `choose` \u65b9\u5f0f\u3002\n* \u89e3\u51b3\u901a\u8fc7`@Column`\u914d\u7f6e\u5173\u952e\u5b57\u7684\u5206\u9694\u7b26\u65f6\uff0c\u65e0\u6cd5\u5f97\u5230\u8be5\u5217\u503c\u7684bug\u3002\n\n## 3.4.0 - 2017-02-19\n\n* `Example` \u589e\u52a0 for update \u652f\u6301\uff0c\u4ec5\u80fd\u7528\u4e8e selectByExample \u548c selectCountByExample \u65b9\u6cd5 #210\n* `Example.Criteria` \u589e\u52a0 `andAllEqualTo` \u65b9\u6cd5\uff0c\u5c06\u6b64\u5bf9\u8c61\u7684\u6240\u6709\u5b57\u6bb5\u53c2\u6570\u4f5c\u4e3a\u76f8\u7b49\u67e5\u8be2\u6761\u4ef6\uff0c\u5982\u679c\u5b57\u6bb5\u4e3a null\uff0c\u5219\u4e3a is null #206\n* \u589e\u52a0\u53c2\u6570 `checkExampleEntityClass`\uff0c\u9ed8\u8ba4 `false` \u7528\u4e8e\u6821\u9a8c\u901a\u7528 Example \u6784\u9020\u53c2\u6570 entityClass \u662f\u5426\u548c\u5f53\u524d\u8c03\u7528\u7684 Mapper\u003CEntityClass\u003E \u7c7b\u578b\u4e00\u81f4 #201\n* \u589e\u52a0\u53c2\u6570 `useSimpleType`\uff0c\u9ed8\u8ba4 `false`\uff0c\u542f\u7528\u540e\u5224\u65ad\u5b9e\u4f53\u7c7b\u5c5e\u6027\u662f\u5426\u4e3a\u8868\u5b57\u6bb5\u65f6\u6821\u9a8c\u5b57\u6bb5\u662f\u5426\u4e3a\u7b80\u5355\u7c7b\u578b\uff0c\u5982\u679c\u4e0d\u662f\u5c31\u5ffd\u7565\u8be5\u5c5e\u6027\uff0c\u8fd9\u4e2a\u914d\u7f6e\u4f18\u5148\u7ea7\u9ad8\u4e8e\u6240\u6709\u6ce8\u89e3\n* \u589e\u52a0\u53c2\u6570 `simpleTypes`\uff0c\u9ed8\u8ba4\u7684\u7b80\u5355\u7c7b\u578b\u5728 `SimpleTypeUtil` \u4e2d\uff0c\u4f7f\u7528\u8be5\u53c2\u6570\u53ef\u4ee5\u589e\u52a0\u989d\u5916\u7684\u7b80\u5355\u7c7b\u578b\uff0c\u901a\u8fc7\u9017\u53f7\u9694\u5f00\u7684\u5168\u9650\u5b9a\u7c7b\u540d\u6dfb\u52a0\n* \u6240\u6709 `RuntimeException` \u5f02\u5e38\u6539\u4e3a `tk.mybatis.mapper.MapperException` \u5f02\u5e38\n* \u6240\u6709 Update \u65b9\u6cd5\u6dfb\u52a0 `@Options(useCache = false, useGeneratedKeys = false)`\uff0cfix #216\n* \u4f7f\u7528\u81ea\u5b9a\u4e49\u7684 `SelectKeyGenerator`\uff0c\u9632\u6b62\u6709\u9ed8\u8ba4\u503c\u65f6\u88ab\u66ff\u6362\u6389 fix #213\n* \u5c06 MapperTemplate \u5c5e\u6027\u6539\u4e3a protected\n* MBG \u63d2\u4ef6\u4e2d generatedKey \u5143\u7d20\u7684 sqlStatement \u5c5e\u6027\u53ef\u4ee5\u914d\u7f6e\u4e3a\u5f62\u5982 select SEQ_{1} from dual \u7684 SQL\uff0c\u5176\u4e2d {0} \u4ee3\u8868\u5c0f\u5199\u7684\u8868\u540d\uff0c{1} \u662f\u5927\u5199\u7684\u8868\u540d\n   MBG \u914d\u7f6e\u793a\u4f8b\u5982\u4e0b,\u7c7b\u4f3c Oracle \u5e8f\u5217\u7684\u914d\u7f6e\u65b9\u5f0f\uff1a\n   ```xml\n   \u003CgeneratedKey column=\"id\" \n        sqlStatement=\"select SEQ_{1}.nextval from dual\" \n        identity=\"false\" \n        type=\"pre\"/\u003E\n   ```\n   \u8fd9\u4e2a\u914d\u7f6e\u751f\u6210\u7684\u4ee3\u7801\u4f1a\u50cf\u4e0b\u9762\u8fd9\u6837\uff1a\n   ```java\n   public class Author {\n       @Id\n       @GeneratedValue(strategy = GenerationType.IDENTITY,\n               generator = \"select SEQ_AUTHOR.nextval from dual\")\n       private Integer id;\n       // \u7701\u7565\u5176\u4ed6\n   }\n   ```\n\n## 3.3.9 - 2016-09-04\n\n* \u589e\u52a0`selectByIds`\u548c`deleteByIds`\uff0c\u7528\u6cd5\u89c1\u901a\u7528Mapper\u63a5\u53e3\u5927\u5168\n* \u6839\u636e**\u674e\u9886\u5317**\u5efa\u8bae\u4fee\u6539`Example`\u4e2d\u7684`propertyMap`#159\n* `Example`\u4e2d\u7684`andIn`\u548c`andNotIn`\u4e2d\u7684\u53c2\u6570`Collection`\u6539\u4e3a`Iterable`\n* \u89e3\u51b3\u9a7c\u5cf0\u8f6c\u4e0b\u5212\u7ebf\u7684\u9519\u8bef\uff0c\u611f\u8c22 ptma, piggsoft \u548c liufor \u7684PR\n* \u589e\u52a0\u5bf9MBG1.3.4\u7684\u652f\u6301\n* MBG\u63d2\u4ef6\u652f\u6301`beginningDelimiter`\u548c`endingDelimiter`\n* MBG\u63d2\u4ef6\u589e\u52a0schema\u914d\u7f6e\uff08catalog\u4e5f\u53ef\u4ee5\u7528\u8fd9\u4e2a\uff09\uff0c\u4f1a\u81ea\u52a8\u5728\u8868\u7684\u6ce8\u89e3\u540d\u5b57\u524d\u9762\u52a0\u4e0a`schema.tablename`\n* MBG\u63d2\u4ef6\u652f\u6301oracle\u83b7\u53d6\u6ce8\u91ca\uff0c\u5176\u4ed6\u6570\u636e\u5e93\u53ef\u4ee5\u5c1d\u8bd5#114\n* MBG\u6269\u5c55\uff0c\u8be6\u60c5\u770b[MyBatis Generator 1.3.4 \u6269\u5c55\uff0c\u53ef\u4ee5\u8bbe\u7f6e Mapper\uff08Dao\uff09\u540e\u7f00](http://blog.csdn.net/isea533/article/details/52430691)\n\n## 3.3.8 - 2016-03-23\n\n* `Example`\u7684`andIn`\u548c`andNotIn`\u65b9\u6cd5\u53c2\u6570\u6539\u4e3a`Collection` #109\n* \u89e3\u51b3ResultMapping.Builder3.2.6\u7248\u672c\u65b0\u589e`lazy`\u65b9\u6cd5\u5bfc\u81f4\u65e0\u6cd5\u517c\u5bb93.2.4~3.2.5\u7248\u672c\u7684\u95ee\u9898\uff0c\u4ecd\u7136\u517c\u5bb93.2.4+\n* \u89e3\u51b3github[#12](https://github.com/abel533/Mapper/issues/12) \u95ee\u9898\n* \u89e3\u51b3#107\n* \u89e3\u51b3\u548c\u5206\u9875\u63d2\u4ef6PageHelper\u4e2dorderBy\u9ed8\u8ba4\u5c5e\u6027\u540d\u76f8\u540c\u5bfc\u81f4\u6392\u5e8f\u7684\u9519\u8bef\n\n## 3.3.7 - 2016-03-12\n\n* `Example`\u589e\u52a0`orderBy`\u65b9\u6cd5\uff0c\u4f7f\u7528\u5c5e\u6027\u8fdb\u884c\u6392\u5e8f\uff0c\u4f8b\u5982\uff1a`example.orderBy(\"id\").desc().orderBy(\"countryname\").orderBy(\"countrycode\").asc();`\n* \u5f53\u5b9e\u4f53\u7c7b\u5305\u542b\u6570\u7ec4\u7c7b\u578b\u7684\u5b57\u6bb5\u65f6\uff0c\u5728`resultMap`\u4e2d\u4e0d\u4f7f\u7528`javaType`\uff0c\u8fd9\u79cd\u60c5\u51b5\u5982\u679c\u51fa\u9519\uff0c\u53ef\u4ee5\u901a\u8fc7`@ColumnType`\u6ce8\u89e3\u8bbe\u7f6e`jdbcType` #103\n* \u5b9e\u4f53\u7c7b\u4e2d\u5ffd\u7565`transient`\u7c7b\u578b\u7684\u5b57\u6bb5#106\n\n## 3.3.6 - 2016-02-20\n\n* \u589e\u52a0\u5bf9mybatis-spring 1.2.4\u7248\u672c\u7684\u652f\u6301\uff0c\u517c\u5bb9\u4e4b\u524d\u7684\u7248\u672c\n\n## 3.3.5 - 2016-02-16\n\n* `Example`\u589e\u52a0\u5bf9\u52a8\u6001\u8868\u540d\u652f\u6301\uff0c\u901a\u8fc7`setTableName`\u8bbe\u7f6e\u8868\u540d\n* \u5728example\u76f8\u5173\u7684\u4e24\u4e2a`update`\u65b9\u6cd5\u4e2d\uff0c\u53c2\u6570\u4e3a\u5b9e\u4f53\u7c7b\u548c`Example`\uff0c\u8fd9\u4e2a\u65b9\u6cd5\u53ea\u80fd\u901a\u8fc7`Example`\u6765\u8bbe\u7f6e\u52a8\u6001\u8868\u540d\uff0c\u4e0d\u652f\u6301\u901a\u8fc7\u5b9e\u4f53\u8bbe\u7f6e\u52a8\u6001\u8868\u540d\n* \u4f18\u5316\u4e24\u4e2a`select count`\u67e5\u8be2\uff0c\u5f53\u8868\u53ea\u6709\u4e00\u4e2a\u4e3b\u952e\u7684\u65f6\u5019\uff0c\u4f7f\u7528`select count(pk)`\uff0c\u5176\u4ed6\u65f6\u5019\u4f7f\u7528`select count(*)`\n\n## 3.3.4 - 2016-01-05\n\n* \u89e3\u51b3insertList\u7684bug#86\n* `Example`\u6784\u9020\u65b9\u6cd5\u589e\u52a0`notNull`\u53c2\u6570\uff0c\u9ed8\u8ba4`false`\uff0c\u5141\u8bb8\u503c\u4e3a`null`\uff0c\u503c\u4e3a`null`\u7684\u65f6\u5019\u4e0d\u52a0\u5165\u5230\u6761\u4ef6\u4e2d\u3002\n* `seqFormat`\u683c\u5f0f\u5316\u53c2\u6570\u589e\u52a0\u7b2c\u56db\u4e2a\u53ef\u914d\u7f6e\u503c`TableName`\n\n## 3.3.3 - 2015-12-30\n\n- \u89e3\u51b3OGNL\u4e2d\u7684and,or\u5927\u5199\u5bfc\u81f4\u7684\u9519\u8bef\n- \u89e3\u51b3SpecialProvider\u4e0d\u652f\u6301insertable\u7684bug#77\n- \u89e3\u51b3JDK6,7\u65e0\u6cd5\u83b7\u53d6\u5b57\u6bb5\u6cdb\u578b\u7c7b\u578b\u7684\u95ee\u9898\u3002\n- \u63d0\u4f9b\u4e00\u4e2aSpring Boot\u96c6\u6210\u7684\u793a\u4f8b: https://github.com/abel533/MyBatis-Spring-Boot\n\n## 3.3.2 - 2015-12-12\n\n- \u89e3\u51b3\u6570\u636e\u8d8a\u754cbug#73\n- \u89e3\u51b3and\u5c11\u7a7a\u683c\u95ee\u9898\n- \u89e3\u51b3order by\u9519\u8bef#74\n- `tk.mybatis.spring.mapper.MapperScannerConfigurer`\u4e2d\u7684\u5c5e\u6027`mapperHelper`\u589e\u52a0setter\u548cgetter\u65b9\u6cd5\uff0c\u65b9\u4fbf\u901a\u8fc7\u4ee3\u7801\u8fdb\u884c\u914d\u7f6e\n\n## 3.3.1 - 2015-12-09\n\n- \u589e\u52a0`enableMethodAnnotation`\u53c2\u6570\uff0c\u53ef\u4ee5\u63a7\u5236\u662f\u5426\u652f\u6301\u65b9\u6cd5\u4e0a\u7684JPA\u6ce8\u89e3\uff0c\u9ed8\u8ba4`false`\u3002\n  \u8bbe\u7f6e`enableMethodAnnotation = true`\u7684\u65f6\u5019\u6ce8\u610f\uff0c\u5982`getRealName`\u6216`setYourName`\u90fd\u4f1a\u4ea7\u751f`realName`\u5c5e\u6027\u6216`yourName`\u5c5e\u6027\uff0c\u5982\u679c\u8be5\u65b9\u6cd5\u5bf9\u5e94\u7684\u5c5e\u6027\u4e0d\u662f\u8868\u4e2d\u7684\u5b57\u6bb5\uff0c\u5c31\u9700\u8981\u7ed9\u65b9\u6cd5\u589e\u52a0`@Transient`\u6ce8\u89e3\u3002\n  \u540c\u6837\u5982\u679c\u4f60\u7684\u5b9e\u4f53\u662f\u7ee7\u627f`Map`\u7c7b\u578b\u7684\uff0c\u4f60\u4e0d\u9700\u8981\u5728\u5b9e\u4f53\u4e2d\u5199`private String userName`\u8fd9\u6837\u7684\u5c5e\u6027\uff0c\u4f60\u53ea\u9700\u8981\u5199`setUserName`\u6216`getUserName`\u8fd9\u6837\u7684\u65b9\u6cd5\u5c31\u53ef\u4ee5\u3002\n- \u5728\u5904\u7406\u7684\u6ce8\u89e3\u7684\u65f6\u5019\uff0c\u4f18\u5148\u4ece`Field`\u83b7\u53d6\uff0c\u7136\u540e\u662f`setter`\u65b9\u6cd5\uff0c\u6700\u540e\u662f`getter`\u65b9\u6cd5\uff0c\u6ce8\u89e3\u91cd\u590d\u7684\u60c5\u51b5\u4e0b\uff0c\u53ea\u83b7\u53d6\u6309\u987a\u5e8f\u5f97\u5230\u7684\u7b2c\u4e00\u4e2a\n- \u4e3a\u4e86\u652f\u6301\u5982`public class Country extends Entity\u003CInteger, String\u003E`\u8fd9\u6837\u7684\u6cdb\u578b\u7c7b\u578b,\u5728\u751f\u6210`#{propertyName}`\u7684\u65f6\u5019\u90fd\u5e26\u4e0a\u4e86`javaType`\u5c5e\u6027\u3002\n  \u4ea7\u751f\u7684\u7ed3\u679c\u5c31\u662f`#{propertyName, javaType=java.lang.Integer}`\u8fd9\u6837\u5b50\u7684\uff0c\u8fd9\u4f1a\u5bfc\u81f4\u5f53\u4f60\u8c03\u7528\u65b9\u6cd5\u65f6\uff0c\u5fc5\u987b\u4fdd\u8bc1\u7c7b\u578b\u4e00\u81f4\u3002\n  \u4e5f\u5c31\u662f\u5047\u8bbe\u4e3b\u952e\u662f`Integer id`\uff0c\u8c03\u7528`selectByPrimaryKey(Object id)`\u7684\u65f6\u5019\uff0c\u53c2\u6570`id`\u5fc5\u987b\u4f7f\u7528`100`\u8fd9\u6837\u7684\u6570\u5b57\uff0c\u4e0d\u80fd\u4f7f\u7528`\"100\"`\u5b57\u7b26\u4e32\uff08\u4ee5\u524d\u7248\u672c\u53ef\u4ee5\uff09\u3002\n  \u5982\u679c\u4e0d\u5e26`javaType`\uff0c\u90a3\u4e48\u5982\u679c`id`\u662f\u4e2a\u6cdb\u578b\uff0cMyBatis\u67e5\u627e\u7684\u65f6\u5019\u5c31\u4f1a\u56e0\u4e3a\u627e\u4e0d\u5230\u6b63\u786e\u7684\u7c7b\u578b\u800c\u629b\u51fa\u5f02\u5e38\u3002\n- \u4e3a\u4e86\u8ba9\u6269\u5c55\u66f4\u65b9\u4fbf\uff0c\u5c06`tk.mybatis.mapper.provider`\u5305\u4e0b\u6240\u6709\u7684\u901a\u7528\u63a5\u53e3\u7684\u5b9e\u73b0\u65b9\u6cd5\u6539\u4e3a\u4e86`String`\u5f62\u5f0f\u3002\n  \u81ea\u5df1\u6269\u5c55\u5355\u8868\u64cd\u4f5c\u7684\u65b9\u6cd5\u662f\u975e\u5e38\u5bb9\u6613\u7684\u4e8b\u60c5\uff0c\u5efa\u8bae\u6709\u4e00\u5b9a\u901a\u7528Mapper\u4f7f\u7528\u57fa\u7840\u7684\u81ea\u884c\u6269\u5c55\uff0c\u6269\u5c55\u53ef\u4ee5\u53c2\u8003[\u5982\u4f55\u6269\u5c55\u901a\u7528\u63a5\u53e3](http://git.oschina.net/free/Mapper/blob/master/wiki/mapper3/6.MyMapper.md)\n- \u65b0\u589e`SqlHelper`\u5de5\u5177\u7c7b\uff0c\u5176\u4e2d\u5305\u542b\u4e86\u5927\u91cf\u53ef\u7528\u7684\u73b0\u6210\u7684SQL\u65b9\u6cd5\n- `@Column`\u6ce8\u89e3\u589e\u52a0\u5bf9`insertable`\u548c`updatable`\u5c5e\u6027\u7684\u652f\u6301\n\n\n## 3.3.0 - 2015-11-01\n\n- \u589e\u52a0\u5bf9\u52a8\u6001\u8868\u540d\u7684\u652f\u6301\uff0c\u9700\u8981\u5b9e\u4f53\u7c7b\u7ee7\u627f`IDynamicTableName`\u63a5\u53e3\uff0c\u7528\u6cd5\u89c1[\u8be6\u7ec6\u8bf4\u660e](http://git.oschina.net/free/Mapper/blob/master/wiki/mapper3/3.2.Use330.md)\n\n- `Example`\u589e\u52a0\u81ea\u5b9a\u4e49\u67e5\u8be2\u6761\u4ef6\uff0c\u63d0\u4f9b\u4e864\u4e2a\u65b9\u6cd5\uff0c\u5177\u4f53\u65b9\u6cd5\u548c\u7528\u6cd5\u89c1[\u8be6\u7ec6\u8bf4\u660e](http://git.oschina.net/free/Mapper/blob/master/wiki/mapper3/3.2.Use330.md)\n\n- \u65b0\u589e`@ColumnType`\u6ce8\u89e3\uff0c\u53ef\u4ee5\u5355\u72ec\u8bbe\u7f6e\u5217\u7684`jdbcType`\u548c`typeHandler`\n\n- `Example`\u7684`in`\u548c`not in`\u4e2d\u7684`List\u003CObject\u003E`\u53c2\u6570\u6539\u4e3a`List\u003C?\u003E`\uff0c\u5141\u8bb8\u4efb\u610f\u7c7b\u578b\n\n- select\u67e5\u8be2\u65b9\u6cd5\u8fd4\u56de\u7c7b\u578b\u4e0d\u5728\u4f7f\u7528`resultType`\uff0c\u6539\u4e3a`resultMap`\uff0c\u56e0\u6b64\u53ef\u4ee5\u652f\u6301`typeHandler`\u7684\u8bfb\u53d6\n\n- `Style`\u81ea\u52a8\u8f6c\u65b9\u5f0f\u65b0\u589e`camelhumpAndUppercase`\u9a7c\u5cf0\u8f6c\u4e0b\u5212\u7ebf\u5927\u5199\u5f62\u5f0f,`camelhumpAndLowercase`\u9a7c\u5cf0\u8f6c\u4e0b\u5212\u7ebf\u5c0f\u5199\u5f62\u5f0f\n\n- MapperTemplate\u4e2d\u7684`getSelectReturnType`\u65b9\u6cd5\u6539\u4e3a`getEntityClass`\uff0c`getBEFORE`\u6539\u4e3a`isBEFORE`\n\n- \u6587\u6863\u4e2d\u589e\u52a0`@GeneratedValue(strategy = GenerationType.IDENTITY)`\u7684\u4e00\u79cd\u91cd\u8981[\u7528\u6cd5\u8bf4\u660e](http://git.oschina.net/free/Mapper/blob/master/wiki/mapper3/3.2.Use330.md)\n\n- \u4fee\u590dselectAll\u4e0d\u652f\u6301`@OrderBy`\u6ce8\u89e3\u7684bug\n\n- \u89e3\u51b3\u4e00\u4e2a\u9a7c\u5cf0\u8f6c\u6362bug\uff0c\u4f8b\u5982`helloWorld`\u4f1a\u8f6c\u6362\u4e3a`hello_world`\uff08\u539f\u5148\u662f`hello_World`\uff09\n\n## 3.2.2 - 2015-09-19\n\n* \u548cSpring\u96c6\u6210\u65f6\uff0c\u5141\u8bb8\u901a\u8fc7`markerInterface`\u5c5e\u6027\u914d\u7f6e\u901a\u7528\u63a5\u53e3\uff08\u6ce8\u610f\u8be5\u5c5e\u6027\u7684\u539f\u6709\u4f5c\u7528\u4e0d\u53d8\uff09\uff0c\u60f3\u8981\u8ba9\u8be5\u63a5\u53e3\u81ea\u52a8\u6ce8\u518c\uff0c\u8be5\u63a5\u53e3\u5c31\u9700\u8981\u7ee7\u627f`tk.mybatis.mapper.common.Marker`\u63a5\u53e3\uff0c`Mapper\u003CT\u003E`\u9ed8\u8ba4\u7ee7\u627f\u8be5\u63a5\u53e3\uff0c\u6240\u4ee5\u5982\u679c\u81ea\u5df1\u7684\u63a5\u53e3\u662f\u7ee7\u627f`Mapper\u003CT\u003E`\u7684\uff0c\u4e0d\u9700\u8981\u518d\u7ee7\u627f\u3002\n* \u89e3\u51b3\u6ce8\u518c\u9ed8\u8ba4\u63a5\u53e3\u65f6\u5b58\u5728\u7684bug\n\n## 3.2.1 - 2015-09-02\n\n* \u89e3\u51b3spring\u96c6\u6210\u4e2d\u53ef\u80fd\u51fa\u73b0definition.getBeanClassName()\u7a7a\u6307\u9488\u5f02\u5e38bug[#49](http://git.oschina.net/free/Mapper/issues/49)\n* \u5173\u4e8e3.2.x\u7248\u672c\uff0c\u8bf7\u4ed4\u7ec6\u770b3.2.0\u7684\u66f4\u65b0\u65e5\u5fd7\uff0c\u6700\u65b0\u7248\u672c\u7684\u6587\u6863\u4e5f\u662f\u9488\u5bf93.2.x\u7248\u672c\u7684\n\n## 3.2.0 - 2015-09-02\n\n* \u79fb\u9664`MapperInterceptor`\u62e6\u622a\u5668\uff0c\u4ee5\u540e\u4e0d\u80fd\u5728\u901a\u8fc7\u62e6\u622a\u5668\u914d\u7f6e\n* \u589e\u52a0mybatis-spring\u7279\u6b8a\u652f\u6301\uff0c\u4e3b\u8981\u662f\u6839\u636emybatis-spring\u9879\u76ee\u589e\u52a0\u4e86\u4e0b\u9762\u4e24\u4e2a\u7c7b\uff1a\n   - `tk.mybatis.spring.mapper.MapperScannerConfigurer`\n   - `tk.mybatis.spring.mapper.MapperFactoryBean`\n* \u8fd9\u4e24\u4e2a\u7c7b\u548cMyBatis\u63d0\u4f9b\u7684\u533a\u522b\u662f\u589e\u52a0\u4e86MapperHelper\u5c5e\u6027\uff0c\u901a\u8fc7\u5728`MapperScannerConfigurer`\u4e2d\u4f7f\u7528`properties`\u5c5e\u6027\u6ce8\u5165\u914d\u7f6e\n* \u8fd9\u4e24\u4e2a\u7c7b\uff0c\u5728\u5168\u540d\u4e0a\u548cMyBatis\u7684\u533a\u522b\u662f`org.mybatis.xxx`\u6539\u4e3a\u4e86`tk.mybatis.xxx`\uff0c\u540d\u5b57\u76f8\u8fd1\uff0c\u66f4\u65b9\u4fbf\u4fee\u6539\u914d\u7f6e\n* \u548cSpring\u96c6\u6210\u65b9\u6cd5\uff1a\n\n```xml\n\u003Cbean class=\"tk.mybatis.spring.mapper.MapperScannerConfigurer\"\u003E\n    \u003Cproperty name=\"basePackage\" value=\"com.isea533.mybatis.mapper\"/\u003E\n    \u003Cproperty name=\"properties\"\u003E\n        \u003Cvalue\u003E\n            mappers=tk.mybatis.mapper.common.Mapper\n        \u003C/value\u003E\n    \u003C/property\u003E\n\u003C/bean\u003E\n```\n\n* \u8fd9\u79cd\u914d\u7f6e\u65b9\u5f0f\u662f\u4e0d\u662f\u7b80\u5355\u7684\u4e0d\u80fd\u518d\u7b80\u5355\u4e86?\n* \u589e\u52a0`style`\u5c5e\u6027\u914d\u7f6e\uff0c\u7528\u6765\u914d\u7f6e\u5bf9\u8c61\u540d/\u5b57\u6bb5\u548c\u8868\u540d/\u5b57\u6bb5\u4e4b\u95f4\u7684\u8f6c\u6362\u65b9\u5f0f\uff0c\u53ef\u9009\u503c\uff1a\n   - `normal`:\u4f7f\u7528\u5b9e\u4f53\u7c7b\u540d/\u5c5e\u6027\u540d\u4f5c\u4e3a\u8868\u540d/\u5b57\u6bb5\u540d\n   - `camelhump`:\u003Cb\u003E\u8fd9\u662f\u9ed8\u8ba4\u503c\u003C/b\u003E\uff0c\u9a7c\u5cf0\u8f6c\u6362\u4e3a\u4e0b\u5212\u7ebf\u5f62\u5f0f\n   - `uppercase`:\u8f6c\u6362\u4e3a\u5927\u5199\n   - `lowercase`:\u8f6c\u6362\u4e3a\u5c0f\u5199\n* \u589e\u52a0\u5b9e\u4f53\u6ce8\u89e3`@NameStyle`\uff0c\u8be5\u6ce8\u89e3\u4f18\u5148\u4e8e\u5168\u5c40\u914d\u7f6e`style`\n* \u89e3\u51b3`example.selectProperties`\u6620\u5c04\u9519\u8bef\u7684bug[#48](http://git.oschina.net/free/Mapper/issues/48)\n\n## 3.1.3 - 2015-08-25\n\n* \u53bb\u6389\u4e863.1.3-SNAPSHOT\u7248\u672c\u4e2d\u7684`MapperOnceInterceptor`\u62e6\u622a\u5668\uff0c\u4e0b\u4e2a\u7248\u672c\u4f1a\u5b8c\u5584`MapperHelper`\u7684\u914d\u7f6e\u65b9\u5f0f\n* `Example`\u589e\u52a0\u4e86`example.selectProperties(\"id\", \"countryname\", ...)`\u65b9\u6cd5\uff0c\u53ef\u4ee5\u6307\u5b9a\u67e5\u8be2\u5217\uff0c\u6ce8\u610f\u8fd9\u91cc\u53c2\u6570\u5199\u7684\u662f\u5c5e\u6027\u540d\uff0c`Example`\u4f1a\u81ea\u52a8\u6620\u5c04\u5230\u5217\u540d\n* `Example`\u589e\u52a0`andEqualTo(\u5b9e\u4f53\u5bf9\u8c61)`\u65b9\u6cd5\uff0c\u53ef\u4ee5\u5c06\u4e00\u4e2a\u5b9e\u4f53\u653e\u8fdb\u53bb\uff0c\u4f1a\u81ea\u52a8\u6839\u636e\u5c5e\u6027\u548c\u503c\u62fc\u51facolumn=value\u7684\u6761\u4ef6 \u003Cb\u003EBob - 0haizhu0@gmail.com \u63d0\u4f9b\u003C/b\u003E\n* MyBatis\u5728\u5904\u7406`\u003Ccache/\u003E`\u548c`@CacheNamespace`\u7684\u65f6\u5019\u4e0d\u7edf\u4e00\uff0c\u53ea\u6709\u4e00\u4e2a\u80fd\u751f\u6548\uff0c\u8fd9\u5bfc\u81f4xml\u4e2d\u914d\u7f6e\u4e8c\u7ea7\u7f13\u5b58\u5bf9\u901a\u7528Mapper\u6ce8\u89e3\u5f62\u5f0f\u7684\u65b9\u6cd5\u65e0\u6548\uff0c\u8be5\u95ee\u9898\u5df2\u89e3\u51b3\n* \u4e8c\u7ea7\u7f13\u5b58\u914d\u7f6e\u65b9\u6cd5\uff0c\u5982\u679c\u63a5\u53e3\u6709\u5bf9\u5e94\u7684xml\uff0c\u5728xml\u4e2d\u914d\u7f6e\u4e8c\u7ea7\u7f13\u5b58\u3002\u5982\u679c\u53ea\u6709\u63a5\u53e3\u6ca1\u6709xml\uff0c\u7528\u6ce8\u89e3\u914d\u7f6e\u4e8c\u7ea7\u7f13\u5b58\u5373\u53ef\n* \u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u4e8c\u7ea7\u7f13\u5b58\u5728xml\u914d\u7f6e\u65f6\uff0c\u53ea\u5bf9\u901a\u7528Mapper\u65b9\u6cd5\u6709\u6548\uff0c\u81ea\u5df1\u7528`@Select`\u7b49\u6ce8\u89e3\u5b9a\u4e49\u7684\u8fd9\u79cd\u4ecd\u7136\u65e0\u6548\uff0c\u8fd9\u79cd\u60c5\u51b5\u53ea\u80fd\u5728xml\u4e2d\u5b9a\u4e49\n\n## 3.1.2 - 2015-07-14\n\n* \u89e3\u51b3\u522b\u540d\u65f6\u7684\u4e00\u79cd\u7279\u6b8a\u60c5\u51b5\uff0c\u4f8b\u5982`@Column(name=\"`desc`\")`\u7684\u65f6\u5019\uff0c\u5c31\u4e0d\u9700\u8981\u81ea\u52a8\u6dfb\u52a0\u522b\u540d\n* \u53cd\u5c04\u83b7\u53d6\u6240\u6709\u5217\u540d\u7684\u65f6\u5019\uff0c\u4e0d\u5728\u81ea\u52a8\u8f6c\u6362\u4e3a\u5927\u5199\u5f62\u5f0f\uff0c\u5bf9\u6570\u636e\u5e93\u533a\u5206\u5927\u5c0f\u5199\u7684\u60c5\u51b5\u6709\u7528\n\n## 3.1.1 - 2015-07-01\n\n* \u89e3\u51b3`ConditionMapper`\u4e2d`selectByCondition`\u548c`updateByCondition`\u65b9\u6cd5\u9519\u8bef\n\n## 3.1.0 - 2015-06-10\n\n* \u57fa\u7840\u5305\u540d\u4ece`com.github.abel533`\u6539\u4e3a`tk.mybatis.mapper`\n* Maven\u7684groupId\u6539\u4e3a`tk.mybatis`,artifactId\u4e3a`mapper`\n* \u589e\u52a0\u548cExample\u529f\u80fd\u7c7b\u4f3c\u7684Condition\u67e5\u8be2\uff0c\u4ec5\u4ec5\u540d\u5b57\u4e0d\u540c\n* \u66f4\u591a\u8be6\u7ec6\u53d8\u5316\u8bf7\u770b[Mapper3\u901a\u7528\u63a5\u53e3\u5927\u5168](http://git.oschina.net/free/Mapper/blob/master/wiki/mapper3/5.Mappers.md)\n* \u5173\u4e8e3.0.x\u7248\u672c\u8bf7\u770b[Mapper3.0.x](http://git.oschina.net/free/Mapper/tree/Mapper3.0.x/)\n\n## 3.0.0 - 2015-06-04\n\n* \u5c06`EntityMapper`\u548c`SqlMapper`\u79fb\u51fa\uff0c\u73b0\u5728\u662f\u72ec\u7acb\u9879\u76ee[EntityMapper](http://git.oschina.net/free/EntityMapper)\n* \u5c06`Mapper\u003CT\u003E`\u5168\u90e8\u63a5\u53e3\u65b9\u6cd5\u62c6\u5206\u4e3a\u72ec\u7acb\u63a5\u53e3\uff0c\u65b9\u4fbf\u9009\u62e9\u96c6\u6210\n* \u589e\u52a0`MySqlMapper\u003CT\u003E`\u5305\u542b\u6279\u91cf\u63d2\u5165\u548c\u5355\u4e2a\u63d2\u5165\uff0c\u6279\u91cf\u63d2\u5165\u53ef\u4ee5\u56de\u5199\u5168\u90e8id\n* \u589e\u52a0`RowBoundsMapper\u003CT\u003E`\u5305\u542b\u4e24\u4e2a\u5206\u9875\u67e5\u8be2\uff0c\u53ef\u4ee5\u914d\u5408[PageHelper](http://git.oschina.net/free/Mybatis_PageHelper)\u5b9e\u73b0\u7269\u7406\u5206\u9875\n* \u8be6\u7ec6\u53d8\u5316\u8bf7\u770b[Mapper3\u53d8\u5316](http://git.oschina.net/free/Mapper/blob/master/wiki/mapper3/1.Changes.md)\n* Mapper2\u8d44\u6df1\u7528\u6237\u8bf7\u770b[Mapper3\u9ad8\u7ea7\u5e94\u7528](http://git.oschina.net/free/Mapper/blob/master/wiki/mapper3/4.Professional.md)\n* [Mapper3\u901a\u7528\u63a5\u53e3\u5927\u5168](http://git.oschina.net/free/Mapper/blob/master/wiki/mapper3/5.Mappers.md)\n* [\u5feb\u901f\u5f00\u53d1\u81ea\u5df1\u7684\u901a\u7528\u63a5\u53e3](http://git.oschina.net/free/Mapper/blob/master/wiki/mapper3/6.MyMapper.md)\n\n\n## 2.3.4 - 2015-06-01\n\n* \u9ad8\u5e76\u53d1\u65f6selectKey\u4f1a\u4ea7\u751f\u5f02\u5e38\uff0c\u89e3\u51b3[#32](http://git.oschina.net/free/Mapper/issues/32)\n\n* \u517c\u5bb9MyBatis3.3.0\u7248\u672c\n\n* \u003Cb\u003E\u63d0\u524d\u9884\u544a\uff1a\u4e0b\u4e2a\u7248\u672c3.0.0\u4f1a\u5c06\u901a\u7528Mapper\u9879\u76ee\u62c6\u5206\u4e3a\u4e24\u4e2a\u9879\u76ee\uff0c\u4f1a\u6709\u4e00\u4e9b\u5927\u7684\u6539\u52a8\u003C/b\u003E\n\n## 2.3.3 - 2015-05-14\n\n* \u89e3\u51b3Example\u67e5\u8be2\u4e2d\u7684`and`\u7f3a\u5c11\u7a7a\u683c\u7684\u95ee\u9898\n\n* \u53bb\u6389UUID\u548cJDBC\u4e24\u79cd\u4e3b\u952e\u7b56\u7565\u7c7b\u578b\u4e2d\u5bf9\u5b57\u6bb5\u7c7b\u578b\u7684\u9650\u5236\n  \u4e0d\u518d\u9650\u5236\u4e3a`String`\uff0c\u53ef\u4ee5\u662f\u4efb\u610f\u7b80\u5355\u7c7b\u578b\uff0c\u9700\u8981\u81ea\u5df1\u4fdd\u8bc1\u7c7b\u578b\u5339\u914d\u3002\u4f8b\u5982UUID\u914d\u7f6e\u7684\u7b56\u7565\u53ef\u4ee5\u8fd4\u56de`Integer`,\u90a3\u4e48\u5b57\u6bb5\u7c7b\u578b\u5fc5\u987b\u662f`Integer`\u3002\n\n* JDBC\u7c7b\u578b\u7684\u4e3b\u952e\u7b56\u7565\u53ef\u4ee5\u914d\u7f6e\u591a\u4e2a\uff0c\u5c31\u76f8\u5f53\u4e8e`keyProperties=\"id1,id2...\"`\n\n* `EntityHelper`\u7684`getOrderByClause`\u65b9\u6cd5\u8fd4\u56de\u503c\u4ece`StringBuilder`\u6539\u4e3a`String`\uff0c\u89e3\u51b3`@OrderBy`\u6ce8\u89e3\u65f6\u7684\u5f02\u5e38\n\n* \u003Cb\u003E\u63d0\u524d\u9884\u544a\uff1a\u4e0b\u4e2a\u7248\u672c3.0.0\u4f1a\u5c06\u901a\u7528Mapper\u9879\u76ee\u62c6\u5206\u4e3a\u4e24\u4e2a\u9879\u76ee\uff0c\u4f1a\u6709\u4e00\u4e9b\u5927\u7684\u6539\u52a8\u003C/b\u003E\n\n## 2.3.2 - 2015-04-21\n\n* \u89e3\u51b3Example\u67e5\u8be2\u4e2din,notin\u65e0\u6548\u7684bug[#24](http://git.oschina.net/free/Mapper/issues/24)\n\n## 2.3.1 - 2015-04-13\n\n* \u5b8c\u5584\u6240\u6709\u548cPrimaryKey\u6709\u5173\u7684\u901a\u7528\u67e5\u8be2\n\n* \u4fee\u590dMapper\u003CT\u003E\u63a5\u53e3\u4e2dupdate\u64cd\u4f5c\u4f1a\u66f4\u65b0\u4e3b\u952e\u7684bug\n\n* \u4fee\u590dMapper\u003CT\u003E\u63a5\u53e3\u4e2d\u4f7f\u7528Example\u67e5\u8be2\u7684\u65f6\u5019\uff0c\u6761\u4ef6and\u524d\u9762\u7f3a\u5c11\u7a7a\u683c\uff0c\u5f71\u54cd\u7f8e\u89c2\n\n* MBG\u63d2\u4ef6\u589e\u52a0caseSensitive\u9ed8\u8ba4false\uff0c\u5f53\u6570\u636e\u5e93\u8868\u540d\u533a\u5206\u5927\u5c0f\u5199\u65f6\uff0c\u53ef\u4ee5\u5c06\u8be5\u5c5e\u6027\u8bbe\u7f6e\u4e3atrue\n\n## 2.3.0 - 2015-04-05\n\n* Mapper\u63a5\u53e3\u548cEntityMapper\u90fd\u589e\u52a0\u4e86`selectOne`\u65b9\u6cd5\uff0c\u8be5\u67e5\u8be2\u8fd4\u56de\u503c\u6700\u591a\u53ea\u80fd\u6709\u4e00\u4e2a\uff0c\u5b58\u5728\u591a\u4e2a\u65f6\u629b\u51fa\u5f02\u5e38\n\n* Mapper\u63a5\u53e3\u548cEntityMapper\u4e2d\uff0c\u8fd4\u56deList\u7684\u67e5\u8be2\u65b9\u6cd5\u90fd\u652f\u6301JPA\u7684`@Orderby`\u6ce8\u89e3\u3002\u5176\u4e2d`Example`\u67e5\u8be2\u4e2d\u7684`orderby`\u4f1a\u8986\u76d6\u6ce8\u89e3\u7684`@Orderby`\u8bbe\u7f6e\u3002\n\n* \u901a\u8fc7\u5b9e\u4f53\u7c7b\u83b7\u53d6\u8868\u540d\u7684\u65f6\u5019\uff0c\u4e0d\u5bf9\u8868\u540d\u8fdb\u884c\u5f3a\u5236\u7684\u5927\u5c0f\u5199\u8f6c\u6362\u3002\u5982\u679c\u6570\u636e\u5e93\u5927\u5c0f\u5199\u654f\u611f\uff0c\u8bf7\u901a\u8fc7`@Table`\u6ce8\u89e3\u548c\u6570\u636e\u5e93\u4fdd\u6301\u4e00\u81f4\u3002\n\n## 2.2.0 - 2015-03-11\n\n* \u65b0\u589e`SqlMapper`\uff0c\u53ef\u4ee5\u4f7f\u7528MyBatis\u76f4\u63a5\u6267\u884csql\uff0c[\u8be6\u7ec6\u6587\u6863](http://git.oschina.net/free/Mapper/blob/master/wiki/UseSqlMapper.md)\n\n## v2.1.0 - 2015-03-07\n\n* \u901a\u7528Mapper\u63a5\u53e3\u589e\u52a0Example\u67e5\u8be2\u65b9\u6cd5\uff0c\u5305\u62ec\u4ee5\u4e0b\u65b9\u6cd5\uff1a\n\n    int selectCountByExample(Object example);\n\n    int deleteByExample(Object example);\n\n    List\u003CT\u003E selectByExample(Object example);\n\n    int updateByExampleSelective(@Param(\"record\") T record, @Param(\"example\") Object example);\n\n    int updateByExample(@Param(\"record\") T record, @Param(\"example\") Object example);\n\n* \u901a\u7528`Example`\u589e\u52a0\u4e86\u4e00\u4e2a`exists`\u7684\u53c2\u6570\uff0c\u5f53`true`\u7684\u65f6\u5019\u5982\u679c\u4f7f\u7528\u7684\u5b57\u6bb5\u4e0d\u5b58\u5728\u4f1a\u629b\u51fa\u5f02\u5e38\uff0c`false`\u65f6\u4e0d\u629b\u51fa\u5f02\u5e38\uff0c\u4f46\u662f\u4e0d\u4f7f\u7528\u8be5\u5b57\u6bb5\u7684\u6761\u4ef6\u3002\n\n## V2.0.1 - 2015-02-28\n\n* \u589e\u52a0\u62e6\u622a\u5668\uff0c\u5b8c\u5584\u76f8\u5e94\u7684\u6587\u6863\n\n## V2.0.0 - 2015-02-04\n\n* \u589e\u52a0\u4e00\u4e2a`CommonMapper`\u548c\u5305\u88c5\u7c7b`EntityMapper`\uff0c\u5efa\u8bae\u4f7f\u7528`EntityMapper`\n* \u6709\u5173`EntityMapper`\u7684\u5185\u5bb9\u8bf7\u770b\u72ec\u7acb\u6587\u6863\uff0c\u8fd9\u4e2a\u7c7b\u8db3\u4ee5\u72ec\u7acb\u6210\u4e00\u4e2a\u5f00\u6e90\u9879\u76ee\n* \u589e\u52a0\u5bf9JPA\u6ce8\u89e3`OrderBy`\u7684\u652f\u6301\uff0c\u4ec5\u5bf9`select`\u4e00\u4e2a\u65b9\u6cd5\u6709\u6548\n\n\u7b80\u5355\u8bf4\u660e\uff0c\u4e3a\u4ec0\u4e48\u7248\u672c\u8fd9\u4e48\u5feb\u5c31\u5230\u4e862.0?\uff0c\u56e0\u4e3a`EntityMapper`\uff0c\u8fd9\u662f\u53e6\u4e00\u79cd\u5f62\u5f0f\u7684\u901a\u7528Mapper\u3002\n\n\u8fd9\u91cc\u8bf4\u8bf4`EntityMapper`\u548c\u901a\u7528Mapper\u7684\u533a\u522b\u3002\n\n\u901a\u7528Mapper\u9700\u8981\u6709\u7ee7\u627f\u7684\u63a5\u53e3\uff0c\u9700\u8981\u6307\u5b9a\u6cdb\u578b\u7c7b\u578b\uff0c\u53ef\u4ee5\u7f13\u5b58\uff0c\u548c\u624b\u5199\u7684\u6548\u679c\u4e00\u6837\u3002\n\n`EntityMapper`\u65e0\u9700\u7ee7\u627f\uff0c\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\uff0c\u800c\u4e14\u8fd9\u4e00\u4e2a\u5bf9\u8c61\u5c31\u53ef\u4ee5\u64cd\u4f5c\u5168\u90e8\u7684\u5b9e\u4f53\u5bf9\u8c61\uff08\u548c\u901a\u7528Mapper\u6ce8\u89e3\u8981\u6c42\u4e00\u6837\uff0c\u4e0d\u652f\u6301\u4e3b\u952e\u7b56\u7565\uff09\u548c\u8868\uff0c\u662f\u4e00\u4e2a\u66f4\u63a5\u8fd1Hibernate\u7528\u6cd5\u7684\u7c7b\uff0c\u8fd9\u4e2a\u7c7b\u975e\u5e38\u5f3a\u5927\uff0c\u652f\u6301Mybatis\u751f\u6210\u7684Example\u67e5\u8be2\uff0c\u8fd8\u652f\u6301\u4e00\u4e2a\u901a\u7528Example\u67e5\u8be2\u3002\n\n`EntityMapper`\u529f\u80fd\u66f4\u5168\u9762\uff0c\u4f46\u662f\u4e0d\u652f\u6301\u4e3b\u952e\u7b56\u7565\uff0c\u7531\u4e8e\u8be5\u7c7b\u8db3\u4ee5\u72ec\u7acb\u6210\u4e00\u4e2a\u5f00\u6e90\u9879\u76ee\uff0c\u7b80\u5355\u51e0\u53e5\u4e0d\u80fd\u8bf4\u660e\u7528\u6cd5\uff0c\u56e0\u6b64\u8be6\u7ec6\u5185\u5bb9\u8bf7\u770b\u72ec\u7acb\u7684\u6587\u6863\u3002\n\n## V1.1.0\n\n* \u5b8c\u5584\u6587\u6863\n* \u89e3\u51b3\u4e3b\u952eselectKey\u7684\u4e00\u4e2abug\n* \u89e3\u51b3@Column\u6ce8\u89e3\u4e3a\u7a7a\u65f6\u7684bug\n* \u5b8c\u5584\u81ea\u52a8\u589e\u957f\u7684\u914d\u7f6e\uff0c\u589e\u52a0\u5bf9JDBC\u7684\u652f\u6301`@GeneratedValue(generator = \"JDBC\")`,\u8be6\u7ec6\u8bf7\u770b\u4e0b\u9762\u5173\u4e8e\u4e3b\u952e\u7b56\u7565\u7684\u8be6\u7ec6\u5185\u5bb9\n* \u589e\u52a0\u4e86\u4e00\u4e2a`notEmpty`\u53c2\u6570\uff0c\u8be5\u53c2\u6570\u4f1a\u5f71\u54cd\u6240\u6709\u4f7f\u7528`getAllIfColumnNode`\u65b9\u6cd5\u7684\u5730\u65b9,\u5177\u4f53\u5230`Mapper\u003CT\u003E`,\u5f71\u54cd3\u4e2a\u65b9\u6cd5\uff1aselect,selectCount,delete\u3002\u5982\u679c\u8bbe\u7f6e\u4e3a`true`\uff0c\u90a3\u4e48`\u003Cif ...`\u7684\u6761\u4ef6\u4e2d\u4f1a\u5305\u542b`String`\u7c7b\u578b`property!=''`\u7684\u6761\u4ef6\u3002\n\n## v1.0.0\u6b63\u5f0f\u53d1\u5e03\u7248\n\n* \u589e\u52a0\u901a\u7528Mapper\u4e13\u7528\u7684MyBatis Generator\u63d2\u4ef6\uff0c\u53ef\u4ee5\u81ea\u52a8\u751f\u6210\u5b9e\u4f53\u7c7b\u6ce8\u89e3\u4ee5\u53caMapper\u63a5\u53e3\u548c\u4e00\u4e2a\u7a7a\u7684xml\u6587\u4ef6\n\n* \u63d2\u4ef6\u540e\u7eed\u53ef\u80fd\u4f1a\u589e\u52a0\u66f4\u591a\u7684\u81ea\u52a8\u751f\u6210\u4ee3\u7801\u3002\n\n* \u6709\u5173\u63d2\u4ef6\u7684\u4f7f\u7528\uff0c\u540e\u7eed\u5b8c\u5584\u6587\u6863\n\n## v0.3.2\u7248\u672c\u8bf4\u660e\n\n\u79fb\u9664\u4e86`MapperInterceptor`\u7c7b\uff0c\u4e0d\u5728\u63d0\u4f9b\u62e6\u622a\u5668\u65b9\u5f0f\u7684\u4f7f\u7528\u3002\u5982\u679c\u6709\u9700\u8981\u53ef\u4ee5\u81ea\u5df1\u4ece0.3.1\u7248\u672c\u83b7\u53d6\u3002\n\n## v0.3.1\u7248\u672c\u8bf4\u660e\n\n\u652f\u6301Spring4\u6cdb\u578b\u6ce8\u5165\uff0c\u8be6\u7ec6\u8bf7\u770b\u6587\u6863[\u5728Spring4\u4e2d\u4f7f\u7528\u901a\u7528Mapper](http://git.oschina.net/free/Mapper/blob/master/UseMapperInSpring4.md) \n\n## v0.3.0\u7248\u672c\u8bf4\u660e\n\n\u8fd9\u4e2a\u7248\u672c\u7684\u4e3b\u8981\u76ee\u7684\u662f\u6d88\u9664\u62e6\u622a\u5668\uff0c\u56e0\u6b64\u9488\u5bf9\u5e38\u7528\u7684\u60c5\u51b5\u589e\u52a0\u4e86\u4e24\u79cd\u66f4\u65b9\u4fbf\u7684\u4f7f\u7528\u65b9\u5f0f\u3002\n\n\n## v0.2.0\u7248\u672c\u8bf4\u660e\n\n\u8be5\u7248\u672c\u505a\u4e86\u5927\u91cf\u7684\u91cd\u6784\uff0c\u5728\u539f\u6709\u57fa\u7840\u4e0a\u589e\u52a0\u4e86\u4e24\u4e2a\u7c7b\uff0c\u5206\u522b\u4e3a`MapperTemplate`\u548c`MapperProvider`\uff0c\u5176\u4ed6\u51e0\u4e2a\u7c7b\u90fd\u6709\u76f8\u5f53\u5927\u7684\u6539\u52a8\u3002  \n\n**\u4f46\u662f**\uff0c\u8fd9\u6b21\u91cd\u6784\u5e76\u4e0d\u5f71\u54cd\u539f\u6709\u7684\u4e1a\u52a1\u4ee3\u7801\u3002  \n\n\u8fd9\u6b21\u91cd\u6784\u7684\u76ee\u7684\u662f\u4e3a\u4e86\u65b9\u4fbf\u5f00\u53d1\u8005\u81ea\u884c\u6269\u5c55\uff0c\u589e\u52a0\u81ea\u5df1\u9700\u8981\u7684\u901a\u7528Mapper\u3002\u8fd9\u6b21\u91cd\u6784\u540e\uff0c\u6269\u5c55\u53d8\u7684\u66f4\u5bb9\u6613\u3002\u7a0d\u540e\u4f1a\u5199\u4e00\u7bc7**\u5982\u4f55\u8fdb\u884c\u6269\u5c55**\u7684\u6587\u6863\u3002  \n\n\u8fd9\u6b21\u66f4\u65b0\u8fd8\u4fee\u590dOracle\u5e8f\u5217\u7684BUG\u3002"},{"id":"e75bc04","pId":0,"name":"faq","parent":"","sort_id":213171,"order":0,"extname":null,"open":true},{"id":"faq","pId":"e75bc04","name":"faq","parent":"faq","order":0,"sort_id":213172,"extname":".md","isHidden":false,"content":"## \u4e03\u3001\u5e38\u89c1\u95ee\u9898\n\n"}],"content":{"208196":"\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"1-1-java-\u7f16\u7801\u65b9\u5f0f\u96c6\u6210_2\" href=\"#1-1-java-\u7f16\u7801\u65b9\u5f0f\u96c6\u6210_2\"\u003E\u003C/a\u003E1.1 Java \u7f16\u7801\u65b9\u5f0f\u96c6\u6210\u003C/h3\u003E\n\u003Cp\u003EJava \u7f16\u7801\u65b9\u5f0f\u96c6\u6210\u662f\u6700\u5c11\u89c1\u7684\u4e00\u79cd\u60c5\u51b5\uff0c\u4f46\u662f\u901a\u8fc7\u8fd9\u79cd\u96c6\u6210\u65b9\u5f0f\u53ef\u4ee5\u5f88\u5bb9\u6613\u8ba9\u5927\u5bb6\u770b\u6e05\u901a\u7528 Mapper \u96c6\u6210\u7684\u5165\u53e3\uff0c\u8fd9\u91cc\u4f1a\u63d0\u4f9b\u4e24\u79cd\u65b9\u5f0f\u3002\u003C/p\u003E\n\n\u003Col class=\"task-list\"\u003E\n\u003Cli\u003E \u6700\u76f4\u63a5\u7684\u65b9\u5f0f\u003C/li\u003E\n\u003Cli\u003E \u4f7f\u7528 \u003Ccode\u003EConfiguration\u003C/code\u003E \u4f5c\u4e3a\u5165\u53e3\u96c6\u6210\u003C/li\u003E\n\u003C/ol\u003E\n\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"1-1-1-\u6dfb\u52a0\u4f9d\u8d56_1\" href=\"#1-1-1-\u6dfb\u52a0\u4f9d\u8d56_1\"\u003E\u003C/a\u003E1.1.1 \u6dfb\u52a0\u4f9d\u8d56\u003C/h4\u003E\n\u003Cp\u003E\u5728\u5f00\u59cb\u5199\u4ee3\u7801\u524d\uff0c\u5148\u628a\u4f9d\u8d56\u6dfb\u52a0\u8fdb\u6765\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u5728 Java \u7f16\u7801\u96c6\u6210\u65b9\u5f0f\u4e2d\uff0c\u9996\u5148\u4f60\u80af\u5b9a\u5df2\u7ecf\u5f15\u5165\u4e86 MyBatis \u7684\u4f9d\u8d56\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nt\"\u003E\u0026lt;dependency\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;groupId\u0026gt;\u003C/span\u003Eorg.mybatis\u003Cspan class=\"nt\"\u003E\u0026lt;/groupId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;artifactId\u0026gt;\u003C/span\u003Emybatis\u003Cspan class=\"nt\"\u003E\u0026lt;/artifactId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;version\u0026gt;\u003C/span\u003E\u7248\u672c\u53f7\u003Cspan class=\"nt\"\u003E\u0026lt;/version\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/dependency\u0026gt;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003E\u6240\u6709\u7248\u672c\u53f7\u770b\u8fd9\u91cc\uff1a\u003Ca target=\"_blank\" href=\"http://mvnrepository.com/artifact/org.mybatis/mybatis\"\u003Ehttp://mvnrepository.com/artifact/org.mybatis/mybatis\u003C/a\u003E\u003C/p\u003E\n\n\u003Cp\u003E\u901a\u7528 Mapper \u652f\u6301 MyBatis 3.2.4+\u003C/p\u003E\n\u003C/blockquote\u003E\n\n\u003Cp\u003E\u5728 mybatis \u4f9d\u8d56\u7684\u57fa\u7840\u4e0a\uff0c\u6dfb\u52a0\u901a\u7528 Mapper \u7684\u4f9d\u8d56\u5373\u53ef\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nt\"\u003E\u0026lt;dependency\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"nt\"\u003E\u0026lt;groupId\u0026gt;\u003C/span\u003Etk.mybatis\u003Cspan class=\"nt\"\u003E\u0026lt;/groupId\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"nt\"\u003E\u0026lt;artifactId\u0026gt;\u003C/span\u003Emapper\u003Cspan class=\"nt\"\u003E\u0026lt;/artifactId\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"nt\"\u003E\u0026lt;version\u0026gt;\u003C/span\u003E\u6700\u65b0\u7248\u672c\u003Cspan class=\"nt\"\u003E\u0026lt;/version\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/dependency\u0026gt;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003E\u6700\u65b0\u7248\u672c\u770b\u8fd9\u91cc\uff1a\u003Ca target=\"_blank\" href=\"http://mvnrepository.com/artifact/tk.mybatis/mapper\"\u003Ehttp://mvnrepository.com/artifact/tk.mybatis/mapper\u003C/a\u003E\u003C/p\u003E\n\u003C/blockquote\u003E\n\n\u003Cp\u003E\u003Cem\u003E\u5982\u679c\u4f60\u4f7f\u7528\u7684 Jar \u5305\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u4e0a\u9762\u63d0\u4f9b\u7684\u94fe\u63a5\u4e0b\u8f7d Jar\u3002\u003C/em\u003E\u003C/p\u003E\n\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"1-1-2-\u7f16\u5199\u4ee3\u7801\u96c6\u6210_1\" href=\"#1-1-2-\u7f16\u5199\u4ee3\u7801\u96c6\u6210_1\"\u003E\u003C/a\u003E1.1.2 \u7f16\u5199\u4ee3\u7801\u96c6\u6210\u003C/h4\u003E\n\u003Cp\u003E\u4f7f\u7528 Java \u7f16\u7801\u65b9\u5f0f\u65f6\uff0c\u6b63\u5e38\u60c5\u51b5\u4e0b\u4f60\u90fd\u4f1a\u6709\u6784\u5efa \u003Ccode\u003ESqlSessionFactory\u003C/code\u003E \u7684\u4ee3\u7801\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u5728\u521b\u5efa \u003Ccode\u003ESqlSessionFactory\u003C/code\u003E \u5bf9\u8c61\u003Cstrong\u003E\u524d\u003C/strong\u003E\u6216\u8005\u003Cstrong\u003E\u540e\u003C/strong\u003E\u5bf9\u5e94\u4e24\u79cd\u914d\u7f6e\u901a\u7528 Mapper \u7684\u65b9\u6cd5\uff0c\u7531\u4e8e\u6ca1\u6709\u63d0\u4f9b mybatis-config.xml \u6587\u4ef6\u7684\u89e3\u6790\u7c7b\uff0c\u8fd9\u91cc\u4f1a\u63a8\u8350\u4f7f\u7528 \u003Cstrong\u003E\u521b\u5efa\u540e\u003C/strong\u003E \u7684\u65b9\u5f0f\u6765\u521b\u5efa\u3002\u003C/p\u003E\n\u003Ch5\u003E\u003Ca class=\"anchor\" id=\"1-1-2-1-\u521b\u5efa\u540e_1\" href=\"#1-1-2-1-\u521b\u5efa\u540e_1\"\u003E\u003C/a\u003E1.1.2.1 \u521b\u5efa\u540e\u003C/h5\u003E\n\u003Cp\u003E\u5728\u521b\u5efa \u003Ccode\u003ESqlSessionFactory\u003C/code\u003E \u540e\uff0c\u5728\u4efb\u4f55\u5176\u4ed6\u8c03\u7528\u53d1\u751f\u524d\uff0c\u4f7f\u7528\u4e0b\u9762\u7684\u65b9\u5f0f\u914d\u7f6e\u901a\u7528 Mapper\u3002\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"c1\"\u003E//\u4ece\u521a\u521a\u521b\u5efa\u7684 sqlSessionFactory \u4e2d\u83b7\u53d6 session\u003C/span\u003E\n\u003Cspan class=\"n\"\u003Esession\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003EsqlSessionFactory\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EopenSession\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n\u003Cspan class=\"c1\"\u003E//\u521b\u5efa\u4e00\u4e2aMapperHelper\u003C/span\u003E\n\u003Cspan class=\"n\"\u003EMapperHelper\u003C/span\u003E \u003Cspan class=\"n\"\u003EmapperHelper\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"k\"\u003Enew\u003C/span\u003E \u003Cspan class=\"n\"\u003EMapperHelper\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n\u003Cspan class=\"c1\"\u003E//\u7279\u6b8a\u914d\u7f6e\u003C/span\u003E\n\u003Cspan class=\"n\"\u003EConfig\u003C/span\u003E \u003Cspan class=\"n\"\u003Econfig\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"k\"\u003Enew\u003C/span\u003E \u003Cspan class=\"n\"\u003EConfig\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n\u003Cspan class=\"c1\"\u003E//\u4e3b\u952e\u81ea\u589e\u56de\u5199\u65b9\u6cd5,\u9ed8\u8ba4\u503cMYSQL,\u8be6\u7ec6\u8bf4\u660e\u8bf7\u770b\u6587\u6863\u003C/span\u003E\n\u003Cspan class=\"n\"\u003Econfig\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EsetIDENTITY\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"MYSQL\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"c1\"\u003E//\u652f\u6301getter\u548csetter\u65b9\u6cd5\u4e0a\u7684\u6ce8\u89e3\u003C/span\u003E\n\u003Cspan class=\"n\"\u003Econfig\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EsetEnableMethodAnnotation\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"kc\"\u003Etrue\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"c1\"\u003E//\u8bbe\u7f6e insert \u548c update \u4e2d\uff0c\u662f\u5426\u5224\u65ad\u5b57\u7b26\u4e32\u7c7b\u578b!=''\u003C/span\u003E\n\u003Cspan class=\"n\"\u003Econfig\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EsetNotEmpty\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"kc\"\u003Etrue\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"c1\"\u003E//\u6821\u9a8cExample\u4e2d\u7684\u7c7b\u578b\u548c\u6700\u7ec8\u8c03\u7528\u65f6Mapper\u7684\u6cdb\u578b\u662f\u5426\u4e00\u81f4\u003C/span\u003E\n\u003Cspan class=\"n\"\u003Econfig\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EsetCheckExampleEntityClass\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"kc\"\u003Etrue\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"c1\"\u003E//\u542f\u7528\u7b80\u5355\u7c7b\u578b\u003C/span\u003E\n\u003Cspan class=\"n\"\u003Econfig\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EsetUseSimpleType\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"kc\"\u003Etrue\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"c1\"\u003E//\u679a\u4e3e\u6309\u7b80\u5355\u7c7b\u578b\u5904\u7406\u003C/span\u003E\n\u003Cspan class=\"n\"\u003Econfig\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EsetEnumAsSimpleType\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"kc\"\u003Etrue\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"c1\"\u003E//\u81ea\u52a8\u5904\u7406\u5173\u952e\u5b57 - mysql\u003C/span\u003E\n\u003Cspan class=\"n\"\u003Econfig\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EsetWrapKeyword\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"`{0}`\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"c1\"\u003E//\u8bbe\u7f6e\u914d\u7f6e\u003C/span\u003E\n\u003Cspan class=\"n\"\u003EmapperHelper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EsetConfig\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Econfig\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"c1\"\u003E//\u6ce8\u518c\u901a\u7528\u63a5\u53e3\uff0c\u548c\u5176\u4ed6\u96c6\u6210\u65b9\u5f0f\u4e2d\u7684 mappers \u53c2\u6570\u4f5c\u7528\u76f8\u540c\u003C/span\u003E\n\u003Cspan class=\"c1\"\u003E//4.0 \u4e4b\u540e\u7684\u7248\u672c\uff0c\u5982\u679c\u7c7b\u4f3c Mapper.class \u8fd9\u6837\u7684\u57fa\u7840\u63a5\u53e3\u5e26\u6709 @RegisterMapper \u6ce8\u89e3\uff0c\u5c31\u4e0d\u5fc5\u5728\u8fd9\u91cc\u6ce8\u518c\u003C/span\u003E\n\u003Cspan class=\"n\"\u003EmapperHelper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EregisterMapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EMapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eclass\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"c1\"\u003E//\u914d\u7f6e mapperHelper \u540e\uff0c\u6267\u884c\u4e0b\u9762\u7684\u64cd\u4f5c\u003C/span\u003E\n\u003Cspan class=\"n\"\u003EmapperHelper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EprocessConfiguration\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Esession\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EgetConfiguration\u003C/span\u003E\u003Cspan class=\"o\"\u003E());\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u5982\u679c\u7701\u7565 \u003Ccode\u003EConfig\u003C/code\u003E \u7684\u914d\u7f6e\uff0c\u4e0a\u8ff0\u4ee3\u7801\u7b80\u5316\u4e3a\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"c1\"\u003E//\u4ece\u521a\u521a\u521b\u5efa\u7684 sqlSessionFactory \u4e2d\u83b7\u53d6 session\u003C/span\u003E\n\u003Cspan class=\"n\"\u003Esession\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003EsqlSessionFactory\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EopenSession\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n\u003Cspan class=\"c1\"\u003E//\u521b\u5efa\u4e00\u4e2aMapperHelper\u003C/span\u003E\n\u003Cspan class=\"n\"\u003EMapperHelper\u003C/span\u003E \u003Cspan class=\"n\"\u003EmapperHelper\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"k\"\u003Enew\u003C/span\u003E \u003Cspan class=\"n\"\u003EMapperHelper\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n\u003Cspan class=\"n\"\u003EmapperHelper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EprocessConfiguration\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Esession\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EgetConfiguration\u003C/span\u003E\u003Cspan class=\"o\"\u003E());\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003E\u901a\u7528 Mapper \u9ed8\u8ba4\u5c31\u662f\u901a\u8fc7 session.getConfiguration() \u83b7\u53d6\u6240\u6709\u7684 MyBatis \u65b9\u6cd5\uff0c\u7136\u540e\u5bf9\u5176\u4e2d\u5c5e\u4e8e\u901a\u7528\u65b9\u6cd5\u7684\u65b9\u6cd5\u8fdb\u884c\u5904\u7406\u3002\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Ch5\u003E\u003Ca class=\"anchor\" id=\"1-1-2-2-\u521b\u5efa\u524d_1\" href=\"#1-1-2-2-\u521b\u5efa\u524d_1\"\u003E\u003C/a\u003E1.1.2.2 \u521b\u5efa\u524d\u003C/h5\u003E\n\u003Cp\u003E\u521b\u5efa\u524d\u5c31\u662f\u901a\u8fc7\u4f7f\u7528 \u003Ccode\u003Etk.mybatis.mapper.session.Configuration\u003C/code\u003E \u66ff\u6362 MyBatis \u4e2d\u7684 \u003Ccode\u003Eorg.apache.ibatis.session.Configuration\u003C/code\u003E \u6765\u5b9e\u73b0\u3002\u914d\u7f6e\u4ee3\u7801\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"n\"\u003EConfiguration\u003C/span\u003E \u003Cspan class=\"n\"\u003Econfiguration\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"k\"\u003Enew\u003C/span\u003E \u003Cspan class=\"n\"\u003EConfiguration\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n\u003Cspan class=\"c1\"\u003E//\u8fd9\u91cc\u53ef\u4ee5\u53c2\u8003\u4e0a\u9762\u7684\u65b9\u5f0f\u6765\u914d\u7f6e MapperHelper\u003C/span\u003E\n\u003Cspan class=\"n\"\u003Econfiguration\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EsetMapperHelper\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"k\"\u003Enew\u003C/span\u003E \u003Cspan class=\"n\"\u003EMapperHelper\u003C/span\u003E\u003Cspan class=\"o\"\u003E());\u003C/span\u003E\n\u003Cspan class=\"n\"\u003EsqlSessionFactory\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"k\"\u003Enew\u003C/span\u003E \u003Cspan class=\"n\"\u003ESqlSessionFactoryBuilder\u003C/span\u003E\u003Cspan class=\"o\"\u003E().\u003C/span\u003E\u003Cspan class=\"na\"\u003Ebuild\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Econfiguration\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003E\u003Cstrong\u003E\u5b9e\u73b0\u539f\u7406\u003C/strong\u003E\uff1a\u003C/p\u003E\n\n\u003Cp\u003E\u8fd9\u79cd\u914d\u7f6e\u65b9\u5f0f\u662f\u901a\u8fc7\u91cd\u5199\u539f \u003Ccode\u003EConfiguration\u003C/code\u003E \u4e2d\u7684 \u003Ccode\u003EaddMappedStatement\u003C/code\u003E \u65b9\u6cd5\u6765\u5b9e\u73b0\u7684\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E  \u003Cspan class=\"nd\"\u003E@Override\u003C/span\u003E\n  \u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kt\"\u003Evoid\u003C/span\u003E \u003Cspan class=\"nf\"\u003EaddMappedStatement\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EMappedStatement\u003C/span\u003E \u003Cspan class=\"n\"\u003Ems\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n    \u003Cspan class=\"k\"\u003Etry\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n      \u003Cspan class=\"kd\"\u003Esuper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EaddMappedStatement\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Ems\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n      \u003Cspan class=\"c1\"\u003E//\u6ca1\u6709\u4efb\u4f55\u914d\u7f6e\u65f6\uff0c\u4f7f\u7528\u9ed8\u8ba4\u914d\u7f6e\u003C/span\u003E\n      \u003Cspan class=\"k\"\u003Eif\u003C/span\u003E \u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"k\"\u003Ethis\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EmapperHelper\u003C/span\u003E \u003Cspan class=\"o\"\u003E==\u003C/span\u003E \u003Cspan class=\"kc\"\u003Enull\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n        \u003Cspan class=\"k\"\u003Ethis\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EmapperHelper\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"k\"\u003Enew\u003C/span\u003E \u003Cspan class=\"n\"\u003EMapperHelper\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n      \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n      \u003Cspan class=\"k\"\u003Ethis\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EmapperHelper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EprocessMappedStatement\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Ems\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n    \u003Cspan class=\"o\"\u003E}\u003C/span\u003E \u003Cspan class=\"k\"\u003Ecatch\u003C/span\u003E \u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EIllegalArgumentException\u003C/span\u003E \u003Cspan class=\"n\"\u003Ee\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n      \u003Cspan class=\"c1\"\u003E//\u8fd9\u91cc\u7684\u5f02\u5e38\u662f\u5bfc\u81f4 Spring \u542f\u52a8\u6b7b\u5faa\u73af\u7684\u5173\u952e\u4f4d\u7f6e\uff0c\u4e3a\u4e86\u907f\u514d\u540e\u7eed\u4f1a\u541e\u5f02\u5e38\uff0c\u8fd9\u91cc\u76f4\u63a5\u8f93\u51fa\u003C/span\u003E\n      \u003Cspan class=\"n\"\u003Ee\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EprintStackTrace\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n      \u003Cspan class=\"k\"\u003Ethrow\u003C/span\u003E \u003Cspan class=\"k\"\u003Enew\u003C/span\u003E \u003Cspan class=\"nf\"\u003ERuntimeException\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Ee\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n    \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n  \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003C/blockquote\u003E\n\n\u003Cp\u003E\u901a\u8fc7\u4e0a\u9762\u5176\u4e2d\u4e00\u79cd\u65b9\u5f0f\u914d\u7f6e\u540e\uff0c\u901a\u7528\u65b9\u6cd5\u90fd\u4f1a\u751f\u6548\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u63a5\u4e0b\u6765\u8bf7\u7ee7\u7eed\u770b\u4e0b\u4e00\u7ae0\u5185\u5bb9\u3002\u003C/p\u003E\n\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"1-1-3-\u7ec6\u5316\u4f9d\u8d56\u7684\u7528\u6cd5_1\" href=\"#1-1-3-\u7ec6\u5316\u4f9d\u8d56\u7684\u7528\u6cd5_1\"\u003E\u003C/a\u003E1.1.3 \u7ec6\u5316\u4f9d\u8d56\u7684\u7528\u6cd5\u003C/h4\u003E\n\u003Cp\u003E\u003Cstrong\u003E\u9996\u5148\u4e0d\u63a8\u8350 Maven \u521d\u5b66\u8005\u770b\u8fd9\u91cc\uff0c\u4e5f\u4e0d\u5efa\u8bae\u901a\u7528 Mapper \u521d\u5b66\u8005\u770b\u8fd9\u91cc\u003C/strong\u003E\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u5728\u51b3\u5b9a\u662f\u5426\u770b\u4e4b\u524d\uff0c\u5148\u770b\u770b\u7ec6\u5316\u4f9d\u8d56\u7528\u6cd5\u7684\u7279\u70b9\uff1a\u003C/p\u003E\n\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E  \u53ef\u4ee5\u4ee5\u6700\u7cbe\u7b80\u7684\u65b9\u5f0f\u5f15\u5165\u901a\u7528 Mapper\uff0c\u6309\u7167\u9700\u8981\u5f15\u5165\u3002\u003C/li\u003E\n\u003Cli\u003E  \u53ef\u4ee5\u5c06\u67d0\u4e2a\u4f9d\u8d56\u66ff\u6362\u4e3a\u81ea\u5df1\u7684\u5b9e\u73b0\u6216\u8005\u9009\u62e9\u7279\u5b9a\u7248\u672c\u7684\u4f9d\u8d56\uff08\u6bd4\u5982\u67d0\u4e9b\u4f9d\u8d56\u53ef\u4ee5\u9009\u62e9 Java 6 \u6216\u8005 Java 8 \u7684\u7248\u672c\uff09\u3002\u003C/li\u003E\n\u003C/ul\u003E\n\n\u003Cp\u003E\u5f53\u4f60\u9700\u8981\u81ea\u5df1\u9009\u62e9\u5177\u4f53\u7684\u4f9d\u8d56\u65f6\uff0c\u7ee7\u7eed\u770b\u4e0b\u9762\u7684\u4ecb\u7ecd\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u901a\u7528 Mapper4 \u4e2d\uff0c\u539f\u6765\u7684 \u003Ccode\u003Etk.mybatis:mapper\u003C/code\u003E \u9879\u76ee\u5df2\u7ecf\u62c6\u5206\uff0c1.1.1 \u4e2d\u6dfb\u52a0\u7684\u4f9d\u8d56\u662f\u901a\u8fc7\u7279\u6b8a\u6253\u5305\u65b9\u5f0f\u5c06\u6240\u6709\u62c6\u5206\u7684\u9879\u76ee\u5408\u5e76\u5230\u4e86\u4e00\u4e2a jar \u5305\u4e2d\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u5982\u679c\u9700\u8981\u5bf9\u4f9d\u8d56\u8fdb\u884c\u8be6\u7ec6\u7684\u5b9a\u5236\uff0c\u53ef\u4ee5\u5206\u522b\u5f15\u5165\u4e0b\u9762\u7684\u4f9d\u8d56\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"c\"\u003E\u0026lt;!-- \u5fc5\u5907\u4f9d\u8d56\uff0c\u63d0\u4f9b\u6838\u5fc3\u529f\u80fd --\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;dependency\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;groupId\u0026gt;\u003C/span\u003Etk.mybatis\u003Cspan class=\"nt\"\u003E\u0026lt;/groupId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;artifactId\u0026gt;\u003C/span\u003Emapper-core\u003Cspan class=\"nt\"\u003E\u0026lt;/artifactId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;version\u0026gt;\u003C/span\u003E${mapper-core.version}\u003Cspan class=\"nt\"\u003E\u0026lt;/version\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/dependency\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"c\"\u003E\u0026lt;!-- \u5982\u679c\u9700\u8981\u901a\u7528 Mapper \u81ea\u5e26\u7684 Mapper \u63a5\u53e3\u548c\u7cfb\u5217\u65b9\u6cd5\uff0c\u9700\u8981\u5f15\u5165\u672c\u4f9d\u8d56 --\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"c\"\u003E\u0026lt;!-- \u62c6\u5206 base \u9879\u76ee\u7684\u76ee\u7684\u5728\u4e8e\u4ee5\u540e\u53ef\u80fd\u4f1a\u63d0\u4f9b\u5176\u4ed6\u7684\u65b9\u5f0f\u6765\u5b9e\u73b0\u63a5\u53e3 --\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;dependency\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;groupId\u0026gt;\u003C/span\u003Etk.mybatis\u003Cspan class=\"nt\"\u003E\u0026lt;/groupId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;artifactId\u0026gt;\u003C/span\u003Emapper-base\u003Cspan class=\"nt\"\u003E\u0026lt;/artifactId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;version\u0026gt;\u003C/span\u003E${mapper-base.version}\u003Cspan class=\"nt\"\u003E\u0026lt;/version\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/dependency\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"c\"\u003E\u0026lt;!-- \u9488\u5bf9\u5f00\u53d1\u4eba\u5458\u7684\u9700\u8981\u63d0\u4f9b\u7684\u4e00\u4e9b\u989d\u5916\u7684\u63a5\u53e3\uff0c\u90fd\u6709\u7279\u6b8a\u7684\u4f7f\u7528\u8981\u6c42 --\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;dependency\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;groupId\u0026gt;\u003C/span\u003Etk.mybatis\u003Cspan class=\"nt\"\u003E\u0026lt;/groupId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;artifactId\u0026gt;\u003C/span\u003Emapper-extra\u003Cspan class=\"nt\"\u003E\u0026lt;/artifactId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;version\u0026gt;\u003C/span\u003E${mapper-extra.version}\u003Cspan class=\"nt\"\u003E\u0026lt;/version\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/dependency\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"c\"\u003E\u0026lt;!-- \u57fa\u4e8e Java8 \u65b9\u6cd5\u5f15\u7528\u7684\u7c7b Example \u5bf9\u8c61 Weekend --\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;dependency\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;groupId\u0026gt;\u003C/span\u003Etk.mybatis\u003Cspan class=\"nt\"\u003E\u0026lt;/groupId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;artifactId\u0026gt;\u003C/span\u003Emapper-weekend\u003Cspan class=\"nt\"\u003E\u0026lt;/artifactId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;version\u0026gt;\u003C/span\u003E${mapper-weekend.version}\u003Cspan class=\"nt\"\u003E\u0026lt;/version\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/dependency\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"c\"\u003E\u0026lt;!-- \u4ee3\u7801\u751f\u6210\u5668 --\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;dependency\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;groupId\u0026gt;\u003C/span\u003Etk.mybatis\u003Cspan class=\"nt\"\u003E\u0026lt;/groupId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;artifactId\u0026gt;\u003C/span\u003Emapper-generator\u003Cspan class=\"nt\"\u003E\u0026lt;/artifactId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;version\u0026gt;\u003C/span\u003E${mapper-generator.version}\u003Cspan class=\"nt\"\u003E\u0026lt;/version\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/dependency\u0026gt;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003E\u8fd9\u4e9b\u4f9d\u8d56\u7684\u7248\u672c\u53f7\u53ef\u4ee5\u901a\u8fc7 mapper-all \u5b50\u6a21\u5757\u8fdb\u884c\u67e5\u770b\u003C/p\u003E\n\n\u003Cp\u003E\u003Ca target=\"_blank\" href=\"https://github.com/abel533/Mapper/tree/master/mapper-all/pom.xml\"\u003Ehttps://github.com/abel533/Mapper/tree/master/mapper-all/pom.xml\u003C/a\u003E\u003C/p\u003E\n\n\u003Cp\u003E\u8fd8\u53ef\u4ee5\u901a\u8fc7\u4e0b\u9762\u7684\u76ee\u5f55\u67e5\u627e\u003C/p\u003E\n\n\u003Cp\u003E\u003Ca target=\"_blank\" href=\"http://central.maven.org/maven2/tk/mybatis/\"\u003Ehttp://central.maven.org/maven2/tk/mybatis/\u003C/a\u003E\u003C/p\u003E\n\u003C/blockquote\u003E\n","208197":"\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"1-2-spring-\u96c6\u6210_2\" href=\"#1-2-spring-\u96c6\u6210_2\"\u003E\u003C/a\u003E1.2 Spring \u96c6\u6210\u003C/h3\u003E\n\u003Cp\u003E\u8fd9\u662f MyBatis \u6700\u5e38\u7528\u7684\u4e00\u79cd\u7684\u73af\u5883\u3002\u901a\u7528 Mapper \u63d0\u4f9b\u4e86\u591a\u79cd\u65b9\u5f0f\u6765\u548c Spring \u8fdb\u884c\u96c6\u6210\u3002\u003C/p\u003E\n\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"1-2-1-\u6dfb\u52a0\u4f9d\u8d56_1\" href=\"#1-2-1-\u6dfb\u52a0\u4f9d\u8d56_1\"\u003E\u003C/a\u003E1.2.1 \u6dfb\u52a0\u4f9d\u8d56\u003C/h4\u003E\n\u003Cp\u003E\u5728\u5f00\u59cb\u914d\u7f6e\u524d\uff0c\u5148\u6dfb\u52a0\u76f8\u5173\u7684\u4f9d\u8d56\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u6b63\u5e38\u60c5\u51b5\u4e0b\uff0cSpring \u548c MyBatis \u7684\u96c6\u6210\u73af\u5883\u4e2d\uff0c\u5e94\u8be5\u5df2\u7ecf\u5b58\u5728\u4e0b\u9762\u7684\u4f9d\u8d56\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nt\"\u003E\u0026lt;dependency\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;groupId\u0026gt;\u003C/span\u003Eorg.mybatis\u003Cspan class=\"nt\"\u003E\u0026lt;/groupId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;artifactId\u0026gt;\u003C/span\u003Emybatis\u003Cspan class=\"nt\"\u003E\u0026lt;/artifactId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;version\u0026gt;\u003C/span\u003E\u7248\u672c\u53f7\u003Cspan class=\"nt\"\u003E\u0026lt;/version\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/dependency\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;dependency\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;groupId\u0026gt;\u003C/span\u003Eorg.mybatis\u003Cspan class=\"nt\"\u003E\u0026lt;/groupId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;artifactId\u0026gt;\u003C/span\u003Emybatis-spring\u003Cspan class=\"nt\"\u003E\u0026lt;/artifactId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;version\u0026gt;\u003C/span\u003E\u7248\u672c\u53f7\u003Cspan class=\"nt\"\u003E\u0026lt;/version\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/dependency\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;dependency\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;groupId\u0026gt;\u003C/span\u003Eorg.springframework\u003Cspan class=\"nt\"\u003E\u0026lt;/groupId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;artifactId\u0026gt;\u003C/span\u003Espring-context\u003Cspan class=\"nt\"\u003E\u0026lt;/artifactId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;version\u0026gt;\u003C/span\u003E\u7248\u672c\u53f7\u003Cspan class=\"nt\"\u003E\u0026lt;/version\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/dependency\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;dependency\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;groupId\u0026gt;\u003C/span\u003Eorg.springframework\u003Cspan class=\"nt\"\u003E\u0026lt;/groupId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;artifactId\u0026gt;\u003C/span\u003Espring-tx\u003Cspan class=\"nt\"\u003E\u0026lt;/artifactId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;version\u0026gt;\u003C/span\u003E\u7248\u672c\u53f7\u003Cspan class=\"nt\"\u003E\u0026lt;/version\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/dependency\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;dependency\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;groupId\u0026gt;\u003C/span\u003Eorg.springframework\u003Cspan class=\"nt\"\u003E\u0026lt;/groupId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;artifactId\u0026gt;\u003C/span\u003Espring-jdbc\u003Cspan class=\"nt\"\u003E\u0026lt;/artifactId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;version\u0026gt;\u003C/span\u003E\u7248\u672c\u53f7\u003Cspan class=\"nt\"\u003E\u0026lt;/version\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/dependency\u0026gt;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003E\u76f8\u5173\u4f9d\u8d56\u548c\u7248\u672c\u53ef\u4ee5\u901a\u8fc7 \u003Ca target=\"_blank\" href=\"http://mvnrepository.com/\"\u003Ehttp://mvnrepository.com/\u003C/a\u003E \u8fdb\u884c\u641c\u7d22\u003C/p\u003E\n\n\u003Cp\u003E\u901a\u7528 Mapper \u652f\u6301 MyBatis 3.2.4+\u003C/p\u003E\n\u003C/blockquote\u003E\n\n\u003Cp\u003E\u96c6\u6210\u901a\u7528 Mapper \u5728\u4e0a\u9762\u7684\u57fa\u7840\u4e0a\u6dfb\u52a0\u4e0b\u9762\u7684\u4f9d\u8d56\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nt\"\u003E\u0026lt;dependency\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"nt\"\u003E\u0026lt;groupId\u0026gt;\u003C/span\u003Etk.mybatis\u003Cspan class=\"nt\"\u003E\u0026lt;/groupId\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"nt\"\u003E\u0026lt;artifactId\u0026gt;\u003C/span\u003Emapper\u003Cspan class=\"nt\"\u003E\u0026lt;/artifactId\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"nt\"\u003E\u0026lt;version\u0026gt;\u003C/span\u003E\u6700\u65b0\u7248\u672c\u003Cspan class=\"nt\"\u003E\u0026lt;/version\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/dependency\u0026gt;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003E\u901a\u7528 Mapper \u6700\u65b0\u7248\u672c\u770b\u8fd9\u91cc\uff1a\u003Ca target=\"_blank\" href=\"http://mvnrepository.com/artifact/tk.mybatis/mapper\"\u003Ehttp://mvnrepository.com/artifact/tk.mybatis/mapper\u003C/a\u003E\u003C/p\u003E\n\n\u003Cp\u003Etk.mybatis:mapper \u4f9d\u8d56\u5305\u542b\u4e86\u901a\u7528 Mapper \u7684\u57fa\u7840\u4ee3\u7801\u4ee5\u53ca\u548c Spring \u96c6\u6210\u5fc5\u987b\u7684\u4ee3\u7801\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"1-2-2-\u548c-spring-\u96c6\u6210_1\" href=\"#1-2-2-\u548c-spring-\u96c6\u6210_1\"\u003E\u003C/a\u003E1.2.2 \u548c Spring \u96c6\u6210\u003C/h4\u003E\n\u003Cp\u003E\u548c Spring \u8fdb\u884c\u96c6\u6210\u65f6\uff0c\u5206\u4e3a XML \u548c\u6ce8\u89e3\u914d\u7f6e\u4e24\u79cd\u65b9\u5f0f\uff0c\u6bcf\u79cd\u65b9\u5f0f\u53c8\u6709\u4e0d\u540c\u7684\u914d\u7f6e\u65b9\u5f0f\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u003Cem\u003E\u8fd9\u91cc\u63d0\u4f9b\u4e86\u5f88\u591a\u914d\u7f6e\u65b9\u5f0f\uff0c\u4f7f\u7528\u65f6\u9009\u62e9\u4e00\u79cd\u6539\u52a8\u6700\u5c0f\u7684\u65b9\u5f0f\u5373\u53ef\uff01\u003C/em\u003E\u003C/p\u003E\n\u003Ch5\u003E\u003Ca class=\"anchor\" id=\"1-2-2-1-xml-\u914d\u7f6e_1\" href=\"#1-2-2-1-xml-\u914d\u7f6e_1\"\u003E\u003C/a\u003E1.2.2.1 XML \u914d\u7f6e\u003C/h5\u003E\n\u003Cp\u003E\u003Cstrong\u003E1.\u4f7f\u7528 \u003Ccode\u003EMapperScannerConfigurer\u003C/code\u003E\u003C/strong\u003E\u003C/p\u003E\n\n\u003Cp\u003E\u548c\u901a\u7528 Mapper \u4ee5\u524d\u7248\u672c\u4e00\u6837\uff0c\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528 tk.mybatis \u63d0\u4f9b\u7684 \u003Ccode\u003Etk.mybatis.spring.mapper.MapperScannerConfigurer\u003C/code\u003E \u8fdb\u884c\u914d\u7f6e\uff0c\u8fd9\u4e2a\u914d\u7f6e\u548c MyBatis \u5b98\u65b9\u63d0\u4f9b\u7684 \u003Ccode\u003Eorg.mybatis.spring.mapper.MapperScannerConfigurer\u003C/code\u003E \u533a\u522b\u53ea\u662f\u7b2c\u4e00\u5c42\u7684\u5305\u540d\uff0c\u003Ccode\u003Etk\u003C/code\u003E \u548c \u003Ccode\u003Eorg\u003C/code\u003E\u3002\u6240\u4ee5\u4f7f\u7528\u8fd9\u79cd\u65b9\u5f0f\u65f6\uff0c\u5982\u679c\u4f60\u9879\u76ee\u5df2\u7ecf\u4f7f\u7528 \u003Ccode\u003Eorg.\u003C/code\u003E \u8fdb\u884c\u4e86\u914d\u7f6e\uff0c\u53ea\u9700\u8981\u6539\u6210 \u003Ccode\u003Etk.\u003C/code\u003E \u5373\u53ef\u3002\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nt\"\u003E\u0026lt;bean\u003C/span\u003E \u003Cspan class=\"na\"\u003Eclass=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"tk.mybatis.spring.mapper.MapperScannerConfigurer\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"nt\"\u003E\u0026lt;property\u003C/span\u003E \u003Cspan class=\"na\"\u003Ename=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"basePackage\"\u003C/span\u003E \u003Cspan class=\"na\"\u003Evalue=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"\u626b\u63cf\u5305\u540d\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E/\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/bean\u0026gt;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u5982\u679c\u4f60\u9700\u8981\u5bf9\u901a\u7528 Mapper \u8fdb\u884c\u7279\u6b8a\u914d\u7f6e\uff0c\u53ef\u4ee5\u6309\u4e0b\u9762\u7684\u65b9\u5f0f\u8fdb\u884c\u914d\u7f6e\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nt\"\u003E\u0026lt;bean\u003C/span\u003E \u003Cspan class=\"na\"\u003Eclass=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"tk.mybatis.spring.mapper.MapperScannerConfigurer\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"nt\"\u003E\u0026lt;property\u003C/span\u003E \u003Cspan class=\"na\"\u003Ename=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"basePackage\"\u003C/span\u003E \u003Cspan class=\"na\"\u003Evalue=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"tk.mybatis.mapper.mapper\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E/\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"nt\"\u003E\u0026lt;property\u003C/span\u003E \u003Cspan class=\"na\"\u003Ename=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"sqlSessionFactoryBeanName\"\u003C/span\u003E \u003Cspan class=\"na\"\u003Evalue=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"sqlSessionFactory\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E/\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"nt\"\u003E\u0026lt;property\u003C/span\u003E \u003Cspan class=\"na\"\u003Ename=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"properties\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E\u0026gt;\u003C/span\u003E\n        \u003Cspan class=\"nt\"\u003E\u0026lt;value\u0026gt;\u003C/span\u003E\n            \u53c2\u6570\u540d=\u503c\n            \u53c2\u6570\u540d2=\u503c2\n            ...\n        \u003Cspan class=\"nt\"\u003E\u0026lt;/value\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"nt\"\u003E\u0026lt;/property\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/bean\u0026gt;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003E\u53ef\u7528\u914d\u7f6e\u7684\u53c2\u6570\u8bf7\u770b\u540e\u7eed\u7684\u914d\u7f6e\u6587\u6863\uff0c\u914d\u7f6e\u53c2\u6570\u65f6\u4e00\u884c\u5199\u4e00\u4e2a\u503c\u3002\u003C/p\u003E\n\u003C/blockquote\u003E\n\n\u003Cp\u003E\u003Cstrong\u003E2.XML \u914d\u7f6e\u4f7f\u7528 \u003Ccode\u003EConfiguration\u003C/code\u003E\u003C/strong\u003E\u003C/p\u003E\n\n\u003Cp\u003E\u5982\u679c\u67d0\u4e9b\u7b2c\u4e09\u65b9\u4e5f\u9700\u8981\u7279\u6b8a\u7684 \u003Ccode\u003EMapperScannerConfigurer\u003C/code\u003E \u65f6\uff0c\u5c31\u4e0d\u80fd\u7528\u4e0a\u9762\u7684\u65b9\u5f0f\u8fdb\u884c\u914d\u7f6e\u4e86\uff0c\u6b64\u65f6\u53ef\u4ee5\u9009\u62e9\u4e0b\u9762\u8fd9\u79cd\u65b9\u5f0f\uff0c\u8fd9\u79cd\u65b9\u5f0f\u8981\u6c42\u4f7f\u7528MyBatis (3.4.0+) \u548c mybatis-spring (1.3.0+)\uff0c\u914d\u7f6e\u65b9\u5f0f\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"c\"\u003E\u0026lt;!--\u4f7f\u7528 Configuration \u65b9\u5f0f\u8fdb\u884c\u914d\u7f6e--\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;bean\u003C/span\u003E \u003Cspan class=\"na\"\u003Eid=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"mybatisConfig\"\u003C/span\u003E \u003Cspan class=\"na\"\u003Eclass=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"tk.mybatis.mapper.session.Configuration\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"c\"\u003E\u0026lt;!-- \u914d\u7f6e\u901a\u7528 Mapper\uff0c\u6709\u4e09\u79cd\u5c5e\u6027\u6ce8\u5165\u65b9\u5f0f --\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"nt\"\u003E\u0026lt;property\u003C/span\u003E \u003Cspan class=\"na\"\u003Ename=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"mapperProperties\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E\u0026gt;\u003C/span\u003E\n        \u003Cspan class=\"nt\"\u003E\u0026lt;value\u0026gt;\u003C/span\u003E\n            notEmpty=true\n        \u003Cspan class=\"nt\"\u003E\u0026lt;/value\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"nt\"\u003E\u0026lt;/property\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/bean\u0026gt;\u003C/span\u003E\n\n\u003Cspan class=\"nt\"\u003E\u0026lt;bean\u003C/span\u003E \u003Cspan class=\"na\"\u003Eid=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"sqlSessionFactory\"\u003C/span\u003E \u003Cspan class=\"na\"\u003Eclass=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"org.mybatis.spring.SqlSessionFactoryBean\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"nt\"\u003E\u0026lt;property\u003C/span\u003E \u003Cspan class=\"na\"\u003Ename=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"dataSource\"\u003C/span\u003E \u003Cspan class=\"na\"\u003Eref=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"dataSource\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E/\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"nt\"\u003E\u0026lt;property\u003C/span\u003E \u003Cspan class=\"na\"\u003Ename=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"configuration\"\u003C/span\u003E \u003Cspan class=\"na\"\u003Eref=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"mybatisConfig\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E/\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/bean\u0026gt;\u003C/span\u003E\n\n\u003Cspan class=\"c\"\u003E\u0026lt;!-- \u4e0d\u9700\u8981\u8003\u8651\u4e0b\u9762\u8fd9\u4e2a\uff0c\u6ce8\u610f\u8fd9\u91cc\u662f org \u7684 --\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;bean\u003C/span\u003E \u003Cspan class=\"na\"\u003Eclass=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"org.mybatis.spring.mapper.MapperScannerConfigurer\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"nt\"\u003E\u0026lt;property\u003C/span\u003E \u003Cspan class=\"na\"\u003Ename=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"basePackage\"\u003C/span\u003E \u003Cspan class=\"na\"\u003Evalue=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"tk.mybatis.mapper.configuration\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E/\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"nt\"\u003E\u0026lt;property\u003C/span\u003E \u003Cspan class=\"na\"\u003Ename=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"sqlSessionFactoryBeanName\"\u003C/span\u003E \u003Cspan class=\"na\"\u003Evalue=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"sqlSessionFactory\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E/\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/bean\u0026gt;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u8fd9\u91cc\u4f7f\u7528\u4e86 \u003Ccode\u003Etk.mybatis.mapper.session.Configuration\u003C/code\u003E \uff0c\u4e5f\u5c31\u662f\u4e0d\u80fd\u901a\u8fc7\u8bfb\u53d6 \u003Ccode\u003Emybatis-config.xml\u003C/code\u003E \u8fdb\u884c\u914d\u7f6e\uff0c\u4e0a\u9762\u8fd9\u79cd\u914d\u7f6e\u66f4\u76f4\u63a5\uff0c\u4f7f\u7528 Spring setter \u914d\u7f6e\u5c5e\u6027\u66f4\u65b9\u4fbf\u3002\u5f53\u9700\u8981\u914d\u7f6e\u901a\u7528 Mapper \u65f6\uff0c\u4f7f\u7528 \u003Ccode\u003EmapperProperties\u003C/code\u003E \u5c5e\u6027\u914d\u7f6e\u5373\u53ef\uff0c\u914d\u7f6e\u65b9\u5f0f\u548c\u524d\u9762\u7684\u76f8\u540c\uff0c\u4e00\u884c\u4e00\u4e2a\u914d\u7f6e\u5373\u53ef\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u914d\u7f6e\u4e86\u4e00\u4e2a mybatisConfig \u7684 bean \u540e\uff0c\u5728 \u003Ccode\u003ESqlSessionFactoryBean\u003C/code\u003E \u4e2d\u6ce8\u5165\u5373\u53ef\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u540e\u9762\u7684 \u003Ccode\u003EMapperScannerConfigurer\u003C/code\u003E \u53ea\u662f\u4e3a\u4e86\u8bf4\u660e\u8fd9\u91cc\u4e0d\u9700\u8981\u4f7f\u7528 \u003Ccode\u003Etk.\u003C/code\u003E \u5f00\u5934\u7684\u7c7b\u8fdb\u884c\u914d\u7f6e\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u8fd9\u79cd\u914d\u7f6e\u65b9\u5f0f\u57fa\u672c\u4e0a\u548c\u4efb\u4f55\u7b2c\u4e09\u65b9\u90fd\u4e0d\u4f1a\u51b2\u7a81\uff0c\u5982\u679c\u4f60\u9047\u5230\u4e86\u7b2c\u4e09\u65b9\u91cd\u5199 \u003Ccode\u003ESqlSessionFactoryBean\u003C/code\u003E \u7684\u60c5\u51b5\uff0c\u5c31\u4f7f\u7528\u524d\u4e00\u79cd\u65b9\u5f0f\u914d\u7f6e\u5373\u53ef\u3002\u003C/p\u003E\n\u003Ch5\u003E\u003Ca class=\"anchor\" id=\"1-2-2-2-\u4f7f\u7528-mapperscan-\u6ce8\u89e3_1\" href=\"#1-2-2-2-\u4f7f\u7528-mapperscan-\u6ce8\u89e3_1\"\u003E\u003C/a\u003E1.2.2.2 \u4f7f\u7528 \u003Ccode\u003E@MapperScan\u003C/code\u003E \u6ce8\u89e3\u003C/h5\u003E\n\u003Cp\u003E\u5982\u679c\u8981\u4f7f\u7528\u8be5\u6ce8\u89e3\u8fdb\u884c\u914d\u7f6e\uff0c\u8bf7\u786e\u8ba4\u9009\u62e9\u7684\u662f \u003Ccode\u003Etk.mybatis.spring.annotation.MapperScan\u003C/code\u003E \u6ce8\u89e3\uff08\u5fc5\u987b\u4f7f\u7528\u5b98\u65b9\u7684\u6ce8\u89e3\u65f6\uff0c\u770b\u4e0b\u9762\u5176\u4ed6\u914d\u7f6e\u65b9\u5f0f\uff09\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u003Ccode\u003Etk\u003C/code\u003E \u63d0\u4f9b\u7684\u8fd9\u4e2a\u6ce8\u89e3\u76f8\u6bd4\u5b98\u65b9\u7684\u591a\u4e86\u4e0b\u9762\u4e24\u4e2a\u5c5e\u6027\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"cm\"\u003E/**\n * \u901a\u7528 Mapper \u7684\u914d\u7f6e\uff0c\u4e00\u884c\u4e00\u4e2a\u914d\u7f6e\n *\n * @return\n */\u003C/span\u003E\n\u003Cspan class=\"n\"\u003EString\u003C/span\u003E\u003Cspan class=\"o\"\u003E[]\u003C/span\u003E \u003Cspan class=\"nf\"\u003Eproperties\u003C/span\u003E\u003Cspan class=\"o\"\u003E()\u003C/span\u003E \u003Cspan class=\"k\"\u003Edefault\u003C/span\u003E \u003Cspan class=\"o\"\u003E{};\u003C/span\u003E\n\n\u003Cspan class=\"cm\"\u003E/**\n * \u8fd8\u53ef\u4ee5\u76f4\u63a5\u914d\u7f6e\u4e00\u4e2a MapperHelper bean\n *\n * @return\n */\u003C/span\u003E\n\u003Cspan class=\"n\"\u003EString\u003C/span\u003E \u003Cspan class=\"nf\"\u003EmapperHelperRef\u003C/span\u003E\u003Cspan class=\"o\"\u003E()\u003C/span\u003E \u003Cspan class=\"k\"\u003Edefault\u003C/span\u003E \u003Cspan class=\"s\"\u003E\"\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u8fd9\u4e24\u4e2a\u914d\u7f6e\u65b9\u5f0f\u4e2d\uff0c\u003Ccode\u003EmapperHelperRef\u003C/code\u003E \u4f18\u5148\u7ea7\u66f4\u9ad8\uff0c\u53ea\u9700\u8981\u9009\u62e9\u5176\u4e2d\u4e00\u79cd\u65b9\u5f0f\u8fdb\u884c\u914d\u7f6e\u5373\u53ef\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u003Cstrong\u003E1.\u4f7f\u7528 \u003Ccode\u003Eproperties\u003C/code\u003E \u914d\u7f6e\u65f6\uff1a\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nd\"\u003E@Configuration\u003C/span\u003E\n\u003Cspan class=\"nd\"\u003E@MapperScan\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Evalue\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"s\"\u003E\"tk.mybatis.mapper.annotation\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E\n    \u003Cspan class=\"n\"\u003Eproperties\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n            \u003Cspan class=\"s\"\u003E\"mappers=tk.mybatis.mapper.common.Mapper\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E\n            \u003Cspan class=\"s\"\u003E\"notEmpty=true\"\u003C/span\u003E\n    \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n\u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eclass\u003C/span\u003E \u003Cspan class=\"nc\"\u003EMyBatisConfigProperties\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u548c XML \u4e2d\u5f88\u50cf\uff0c\u4ecd\u7136\u4e00\u4e2a\u4e00\u4e2a\u914d\u7f6e\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u003Cstrong\u003E2.\u4f7f\u7528 \u003Ccode\u003EmapperHelperRef\u003C/code\u003E \u914d\u7f6e\u65f6\uff1a\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nd\"\u003E@Configuration\u003C/span\u003E\n\u003Cspan class=\"nd\"\u003E@MapperScan\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Evalue\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"s\"\u003E\"tk.mybatis.mapper.annotation\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E \u003Cspan class=\"n\"\u003EmapperHelperRef\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"s\"\u003E\"mapperHelper\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n\u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kd\"\u003Estatic\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eclass\u003C/span\u003E \u003Cspan class=\"nc\"\u003EMyBatisConfigRef\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n    \u003Cspan class=\"c1\"\u003E//\u5176\u4ed6\u003C/span\u003E\n\n    \u003Cspan class=\"nd\"\u003E@Bean\u003C/span\u003E\n    \u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"n\"\u003EMapperHelper\u003C/span\u003E \u003Cspan class=\"nf\"\u003EmapperHelper\u003C/span\u003E\u003Cspan class=\"o\"\u003E()\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003EConfig\u003C/span\u003E \u003Cspan class=\"n\"\u003Econfig\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"k\"\u003Enew\u003C/span\u003E \u003Cspan class=\"n\"\u003EConfig\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003EList\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003EClass\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"n\"\u003Emappers\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"k\"\u003Enew\u003C/span\u003E \u003Cspan class=\"n\"\u003EArrayList\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003EClass\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;();\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003Emappers\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eadd\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EMapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eclass\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003Econfig\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EsetMappers\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Emappers\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\n        \u003Cspan class=\"n\"\u003EMapperHelper\u003C/span\u003E \u003Cspan class=\"n\"\u003EmapperHelper\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"k\"\u003Enew\u003C/span\u003E \u003Cspan class=\"n\"\u003EMapperHelper\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003EmapperHelper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EsetConfig\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Econfig\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n        \u003Cspan class=\"k\"\u003Ereturn\u003C/span\u003E \u003Cspan class=\"n\"\u003EmapperHelper\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n    \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u8fd9\u91cc\u914d\u7f6e \u003Ccode\u003EmapperHelperRef = \u0026quot;mapperHelper\u0026quot;\u003C/code\u003E\uff0c\u5e76\u4e14\u63d0\u4f9b\u4e86\u4e00\u4e2a\u540d\u4e3a \u003Ccode\u003EmapperHelper\u003C/code\u003E \u7684 \u003Ccode\u003Ebean\u003C/code\u003E\u3002\u5bf9\u901a\u7528 Mapper \u7684\u4efb\u4f55\u914d\u7f6e\u76f4\u63a5\u901a\u8fc7\u7f16\u7801\u5bf9 MapperHelper \u8fdb\u884c\u914d\u7f6e\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u003Cstrong\u003E3.\u4f7f\u7528 \u003Ccode\u003EConfiguration\u003C/code\u003E \u8fdb\u884c\u914d\u7f6e\u003C/strong\u003E\u003C/p\u003E\n\n\u003Cp\u003E\u8fd9\u91cc\u53ef\u4ee5\u4f7f\u7528 tk \u6216\u8005 MyBatis \u5b98\u65b9\u7684 \u003Ccode\u003E@MapperScan\u003C/code\u003E \u6ce8\u89e3\u3002\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nd\"\u003E@Configuration\u003C/span\u003E\n\u003Cspan class=\"nd\"\u003E@MapperScan\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Evalue\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"s\"\u003E\"tk.mybatis.mapper.annotation\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n\u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kd\"\u003Estatic\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eclass\u003C/span\u003E \u003Cspan class=\"nc\"\u003EMyBatisConfigRef\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n\n    \u003Cspan class=\"nd\"\u003E@Bean\u003C/span\u003E\n    \u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"n\"\u003ESqlSessionFactory\u003C/span\u003E \u003Cspan class=\"nf\"\u003EsqlSessionFactory\u003C/span\u003E\u003Cspan class=\"o\"\u003E()\u003C/span\u003E \u003Cspan class=\"kd\"\u003Ethrows\u003C/span\u003E \u003Cspan class=\"n\"\u003EException\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003ESqlSessionFactoryBean\u003C/span\u003E \u003Cspan class=\"n\"\u003EsessionFactory\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"k\"\u003Enew\u003C/span\u003E \u003Cspan class=\"n\"\u003ESqlSessionFactoryBean\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003EsessionFactory\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EsetDataSource\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EdataSource\u003C/span\u003E\u003Cspan class=\"o\"\u003E());\u003C/span\u003E\n        \u003Cspan class=\"c1\"\u003E//tk.mybatis.mapper.session.Configuration\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003EConfiguration\u003C/span\u003E \u003Cspan class=\"n\"\u003Econfiguration\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"k\"\u003Enew\u003C/span\u003E \u003Cspan class=\"n\"\u003EConfiguration\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n        \u003Cspan class=\"c1\"\u003E//\u53ef\u4ee5\u5bf9 MapperHelper \u8fdb\u884c\u914d\u7f6e\u540e set\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003Econfiguration\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EsetMapperHelper\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"k\"\u003Enew\u003C/span\u003E \u003Cspan class=\"n\"\u003EMapperHelper\u003C/span\u003E\u003Cspan class=\"o\"\u003E());\u003C/span\u003E\n        \u003Cspan class=\"c1\"\u003E//\u8bbe\u7f6e\u4e3a tk \u63d0\u4f9b\u7684 Configuration\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003EsessionFactory\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EsetConfiguration\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Econfiguration\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n        \u003Cspan class=\"k\"\u003Ereturn\u003C/span\u003E \u003Cspan class=\"n\"\u003EsessionFactory\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EgetObject\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n    \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003E\u003Ccode\u003E@MapperScan\u003C/code\u003E \u6ce8\u89e3\u5728 Spring Boot \u96c6\u6210\u4e2d\u8fd8\u4f1a\u63d0\u5230\u3002\u003C/p\u003E\n\u003C/blockquote\u003E\n\n\u003Cp\u003E\u6587\u6863\u5230\u8fd9\u91cc\u5c31\u96c6\u6210\u597d\u901a\u7528 Mapper \u4e86\uff0c\u63a5\u4e0b\u6765\u8bf7\u7ee7\u7eed\u770b\u4e0b\u4e00\u7ae0\u5185\u5bb9\u3002\u003C/p\u003E\n\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"1-2-3-\u7ec6\u5316\u4f9d\u8d56\u7684\u7528\u6cd5_1\" href=\"#1-2-3-\u7ec6\u5316\u4f9d\u8d56\u7684\u7528\u6cd5_1\"\u003E\u003C/a\u003E1.2.3 \u7ec6\u5316\u4f9d\u8d56\u7684\u7528\u6cd5\u003C/h4\u003E\n\u003Cp\u003E\u003Cstrong\u003E\u9996\u5148\u4e0d\u63a8\u8350 Maven \u521d\u5b66\u8005\u770b\u8fd9\u91cc\uff0c\u4e5f\u4e0d\u5efa\u8bae\u901a\u7528 Mapper \u521d\u5b66\u8005\u770b\u8fd9\u91cc\u003C/strong\u003E\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u5728\u51b3\u5b9a\u662f\u5426\u770b\u4e4b\u524d\uff0c\u5148\u770b\u770b\u7ec6\u5316\u4f9d\u8d56\u7528\u6cd5\u7684\u7279\u70b9\uff1a\u003C/p\u003E\n\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E  \u53ef\u4ee5\u4ee5\u6700\u7cbe\u7b80\u7684\u65b9\u5f0f\u5f15\u5165\u901a\u7528 Mapper\uff0c\u6309\u7167\u9700\u8981\u5f15\u5165\u3002\u003C/li\u003E\n\u003Cli\u003E  \u53ef\u4ee5\u5c06\u67d0\u4e2a\u4f9d\u8d56\u66ff\u6362\u4e3a\u81ea\u5df1\u7684\u5b9e\u73b0\u6216\u8005\u9009\u62e9\u7279\u5b9a\u7248\u672c\u7684\u4f9d\u8d56\uff08\u6bd4\u5982\u67d0\u4e9b\u4f9d\u8d56\u53ef\u4ee5\u9009\u62e9 Java 6 \u6216\u8005 Java 8 \u7684\u7248\u672c\uff09\u3002\u003C/li\u003E\n\u003Cli\u003E  \u652f\u6301 Spring \u9ad8\u7248\u672c\u7684\u7279\u6b8a\u7528\u6cd5\uff08\u4f8b\u5982\u591a\u4e2a \u003Ccode\u003E@MapperScan\u003C/code\u003E\u6ce8\u89e3\uff0c\u6682\u65f6\u8fd8\u6ca1\u63d0\u4f9b\uff09\u003C/li\u003E\n\u003C/ul\u003E\n\n\u003Cp\u003E\u901a\u7528 Mapper4 \u4e2d\uff0c\u539f\u6765\u7684 \u003Ccode\u003Etk.mybatis:mapper\u003C/code\u003E \u9879\u76ee\u5df2\u7ecf\u62c6\u5206\uff0c1.2.1 \u4e2d\u6dfb\u52a0\u7684\u4f9d\u8d56\u662f\u901a\u8fc7\u7279\u6b8a\u6253\u5305\u65b9\u5f0f\u5c06\u6240\u6709\u62c6\u5206\u7684\u9879\u76ee\u5408\u5e76\u5230\u4e86\u4e00\u4e2a jar \u5305\u4e2d\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u5982\u679c\u9700\u8981\u5bf9\u4f9d\u8d56\u8fdb\u884c\u8be6\u7ec6\u7684\u5b9a\u5236\uff0c\u53ef\u4ee5\u5206\u522b\u5f15\u5165\u4e0b\u9762\u7684\u4f9d\u8d56\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"c\"\u003E\u0026lt;!-- \u5fc5\u5907\u4f9d\u8d56\uff0c\u63d0\u4f9b\u6838\u5fc3\u529f\u80fd --\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;dependency\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;groupId\u0026gt;\u003C/span\u003Etk.mybatis\u003Cspan class=\"nt\"\u003E\u0026lt;/groupId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;artifactId\u0026gt;\u003C/span\u003Emapper-core\u003Cspan class=\"nt\"\u003E\u0026lt;/artifactId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;version\u0026gt;\u003C/span\u003E${mapper-core.version}\u003Cspan class=\"nt\"\u003E\u0026lt;/version\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/dependency\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"c\"\u003E\u0026lt;!-- \u5982\u679c\u9700\u8981\u901a\u7528 Mapper \u81ea\u5e26\u7684 Mapper \u63a5\u53e3\u548c\u7cfb\u5217\u65b9\u6cd5\uff0c\u9700\u8981\u5f15\u5165\u672c\u4f9d\u8d56 --\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"c\"\u003E\u0026lt;!-- \u62c6\u5206 base \u9879\u76ee\u7684\u76ee\u7684\u5728\u4e8e\u4ee5\u540e\u53ef\u80fd\u4f1a\u63d0\u4f9b\u5176\u4ed6\u7684\u65b9\u5f0f\u6765\u5b9e\u73b0\u63a5\u53e3 --\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;dependency\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;groupId\u0026gt;\u003C/span\u003Etk.mybatis\u003Cspan class=\"nt\"\u003E\u0026lt;/groupId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;artifactId\u0026gt;\u003C/span\u003Emapper-base\u003Cspan class=\"nt\"\u003E\u0026lt;/artifactId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;version\u0026gt;\u003C/span\u003E${mapper-base.version}\u003Cspan class=\"nt\"\u003E\u0026lt;/version\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/dependency\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"c\"\u003E\u0026lt;!-- \u9488\u5bf9\u5f00\u53d1\u4eba\u5458\u7684\u9700\u8981\u63d0\u4f9b\u7684\u4e00\u4e9b\u989d\u5916\u7684\u63a5\u53e3\uff0c\u90fd\u6709\u7279\u6b8a\u7684\u4f7f\u7528\u8981\u6c42 --\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;dependency\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;groupId\u0026gt;\u003C/span\u003Etk.mybatis\u003Cspan class=\"nt\"\u003E\u0026lt;/groupId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;artifactId\u0026gt;\u003C/span\u003Emapper-extra\u003Cspan class=\"nt\"\u003E\u0026lt;/artifactId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;version\u0026gt;\u003C/span\u003E${mapper-extra.version}\u003Cspan class=\"nt\"\u003E\u0026lt;/version\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/dependency\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"c\"\u003E\u0026lt;!-- \u57fa\u4e8e Java8 \u65b9\u6cd5\u5f15\u7528\u7684\u7c7b Example \u5bf9\u8c61 Weekend --\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;dependency\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;groupId\u0026gt;\u003C/span\u003Etk.mybatis\u003Cspan class=\"nt\"\u003E\u0026lt;/groupId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;artifactId\u0026gt;\u003C/span\u003Emapper-weekend\u003Cspan class=\"nt\"\u003E\u0026lt;/artifactId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;version\u0026gt;\u003C/span\u003E${mapper-weekend.version}\u003Cspan class=\"nt\"\u003E\u0026lt;/version\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/dependency\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"c\"\u003E\u0026lt;!-- \u4ee3\u7801\u751f\u6210\u5668 --\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;dependency\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;groupId\u0026gt;\u003C/span\u003Etk.mybatis\u003Cspan class=\"nt\"\u003E\u0026lt;/groupId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;artifactId\u0026gt;\u003C/span\u003Emapper-generator\u003Cspan class=\"nt\"\u003E\u0026lt;/artifactId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;version\u0026gt;\u003C/span\u003E${mapper-generator.version}\u003Cspan class=\"nt\"\u003E\u0026lt;/version\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/dependency\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"c\"\u003E\u0026lt;!-- Spring \u96c6\u6210\u5fc5\u5907 --\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;dependency\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;groupId\u0026gt;\u003C/span\u003Etk.mybatis\u003Cspan class=\"nt\"\u003E\u0026lt;/groupId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;artifactId\u0026gt;\u003C/span\u003Emapper-spring\u003Cspan class=\"nt\"\u003E\u0026lt;/artifactId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;version\u0026gt;\u003C/span\u003E${mapper-spring.version}\u003Cspan class=\"nt\"\u003E\u0026lt;/version\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/dependency\u0026gt;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003E\u8fd9\u4e9b\u4f9d\u8d56\u7684\u7248\u672c\u53f7\u53ef\u4ee5\u901a\u8fc7 mapper-all \u5b50\u6a21\u5757\u8fdb\u884c\u67e5\u770b\u003C/p\u003E\n\n\u003Cp\u003E\u003Ca target=\"_blank\" href=\"https://github.com/abel533/Mapper/tree/master/mapper-all/pom.xml\"\u003Ehttps://github.com/abel533/Mapper/tree/master/mapper-all/pom.xml\u003C/a\u003E\u003C/p\u003E\n\n\u003Cp\u003E\u8fd8\u53ef\u4ee5\u901a\u8fc7\u4e0b\u9762\u7684\u76ee\u5f55\u67e5\u627e\u003C/p\u003E\n\n\u003Cp\u003E\u003Ca target=\"_blank\" href=\"http://central.maven.org/maven2/tk/mybatis/\"\u003Ehttp://central.maven.org/maven2/tk/mybatis/\u003C/a\u003E\u003C/p\u003E\n\u003C/blockquote\u003E\n","208198":"\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"1-3-spring-boot-\u96c6\u6210_2\" href=\"#1-3-spring-boot-\u96c6\u6210_2\"\u003E\u003C/a\u003E1.3 Spring Boot \u96c6\u6210\u003C/h3\u003E\n\u003Cp\u003ESpring Boot \u5728\u5fae\u670d\u52a1\u9886\u57df\u4e2d\u5df2\u7ecf\u6210\u4e3a\u4e3b\u6d41\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u8fd9\u91cc\u4ecb\u7ecd\u901a\u7528 Mapper \u5982\u4f55\u540c Spring Boot \u8fdb\u884c\u96c6\u6210\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u4e3a\u4e86\u80fd\u9002\u5e94\u5404\u79cd\u60c5\u51b5\u7684\u7528\u6cd5\uff0c\u8fd9\u91cc\u4e5f\u63d0\u4f9b\u4e86\u591a\u79cd\u96c6\u6210\u65b9\u5f0f\uff0c\u57fa\u672c\u4e0a\u5206\u4e3a\u4e24\u5927\u7c7b\u3002\u003C/p\u003E\n\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E  \u57fa\u4e8e starter \u7684\u81ea\u52a8\u914d\u7f6e\u003C/li\u003E\n\u003Cli\u003E  \u57fa\u4e8e \u003Ccode\u003E@MapperScan\u003C/code\u003E \u6ce8\u89e3\u7684\u624b\u5de5\u914d\u7f6e\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch5\u003E\u003Ca class=\"anchor\" id=\"1-3-1-mapper-spring-boot-starter_1\" href=\"#1-3-1-mapper-spring-boot-starter_1\"\u003E\u003C/a\u003E1.3.1 mapper-spring-boot-starter\u003C/h5\u003E\n\u003Cp\u003E\u4f60\u53ea\u9700\u8981\u6dfb\u52a0\u901a\u7528 Mapper \u63d0\u4f9b\u7684 starter \u5c31\u5b8c\u6210\u4e86\u6700\u57fa\u672c\u7684\u96c6\u6210\uff0c\u4f9d\u8d56\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nt\"\u003E\u0026lt;dependency\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;groupId\u0026gt;\u003C/span\u003Etk.mybatis\u003Cspan class=\"nt\"\u003E\u0026lt;/groupId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;artifactId\u0026gt;\u003C/span\u003Emapper-spring-boot-starter\u003Cspan class=\"nt\"\u003E\u0026lt;/artifactId\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;version\u0026gt;\u003C/span\u003E\u7248\u672c\u53f7\u003Cspan class=\"nt\"\u003E\u0026lt;/version\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/dependency\u0026gt;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ca href=\"https://maven-badges.herokuapp.com/maven-central/tk.mybatis/mapper-spring-boot-starter\"\u003E\u003Cimg alt=\"Maven central\" src=\"https://maven-badges.herokuapp.com/maven-central/tk.mybatis/mapper-spring-boot-starter/badge.svg\" /\u003E\u003C/a\u003E\u003C/p\u003E\n\n\u003Cblockquote\u003E\n\u003Cp\u003E\u6700\u65b0\u7248\u672c\u53f7\u5982\u4e0a\u6240\u793a\uff0c\u4f60\u4e5f\u53ef\u4ee5\u4ece\u4e0b\u9762\u5730\u5740\u67e5\u770b\uff1a\u003C/p\u003E\n\n\u003Cp\u003E\u003Ca target=\"_blank\" href=\"http://mvnrepository.com/artifact/tk.mybatis/mapper-spring-boot-starter\"\u003Ehttp://mvnrepository.com/artifact/tk.mybatis/mapper-spring-boot-starter\u003C/a\u003E\u003C/p\u003E\n\n\u003Cp\u003E\u003Cstrong\u003E\u6ce8\u610f\uff1a\u5f15\u5165\u8be5 starter \u65f6\uff0c\u548c MyBatis \u5b98\u65b9\u7684 starter \u6ca1\u6709\u51b2\u7a81\uff0c\u4f46\u662f\u5b98\u65b9\u7684\u81ea\u52a8\u914d\u7f6e\u4e0d\u4f1a\u751f\u6548\uff01\u003C/strong\u003E\u003C/p\u003E\n\u003C/blockquote\u003E\n\n\u003Cp\u003E\u5982\u679c\u4f60\u9700\u8981\u5bf9\u901a\u7528 Mapper \u8fdb\u884c\u914d\u7f6e\uff0c\u4f60\u53ef\u4ee5\u5728 Spring Boot \u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u914d\u7f6e \u003Ccode\u003Emapper.\u003C/code\u003E \u524d\u7f00\u7684\u914d\u7f6e\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u4f8b\u5982\u5728 yml \u683c\u5f0f\u4e2d\u914d\u7f6e\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"na\"\u003Emapper\u003C/span\u003E\u003Cspan class=\"pi\"\u003E:\u003C/span\u003E\n  \u003Cspan class=\"na\"\u003Emappers\u003C/span\u003E\u003Cspan class=\"pi\"\u003E:\u003C/span\u003E\n    \u003Cspan class=\"pi\"\u003E-\u003C/span\u003E \u003Cspan class=\"s\"\u003Etk.mybatis.mapper.common.Mapper\u003C/span\u003E\n    \u003Cspan class=\"pi\"\u003E-\u003C/span\u003E \u003Cspan class=\"s\"\u003Etk.mybatis.mapper.common.Mapper2\u003C/span\u003E\n  \u003Cspan class=\"na\"\u003EnotEmpty\u003C/span\u003E\u003Cspan class=\"pi\"\u003E:\u003C/span\u003E \u003Cspan class=\"no\"\u003Etrue\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u5728 propertie \u914d\u7f6e\u4e2d\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"py\"\u003Emapper.mappers\u003C/span\u003E\u003Cspan class=\"p\"\u003E=\u003C/span\u003E\u003Cspan class=\"s\"\u003Etk.mybatis.mapper.common.Mapper,tk.mybatis.mapper.common.Mapper2\u003C/span\u003E\n\u003Cspan class=\"py\"\u003Emapper.notEmpty\u003C/span\u003E\u003Cspan class=\"p\"\u003E=\u003C/span\u003E\u003Cspan class=\"s\"\u003Etrue\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u7531\u4e8e Spring Boot \u652f\u6301 Relax \u65b9\u5f0f\u7684\u53c2\u6570\uff0c\u56e0\u6b64\u4f60\u5728\u914d\u7f6e \u003Ccode\u003EnotEmpty\u003C/code\u003E \u65f6\u66f4\u591a\u7684\u662f\u7528 \u003Ccode\u003Enot-empty\u003C/code\u003E\uff0c\u4e5f\u53ea\u6709\u5728 Spring Boot \u4e2d\u4f7f\u7528\u7684\u65f6\u5019\u53c2\u6570\u540d\u4e0d\u5fc5\u548c\u914d\u7f6e\u4e2d\u7684\u5b8c\u5168\u4e00\u81f4\u3002\u003C/p\u003E\n\n\u003Cblockquote\u003E\n\u003Cp\u003E\u5982\u679c\u4f60\u5bf9 Spring Boot \u7684 Environment \u4e86\u89e3\uff0c\u4f60\u53ef\u4ee5\u7528 Spring Boot \u652f\u6301\u7684\u6240\u6709\u65b9\u5f0f\u8fdb\u884c\u914d\u7f6e\u3002\u003C/p\u003E\n\u003C/blockquote\u003E\n\n\u003Cp\u003E\u5173\u4e8e\u901a\u7528 Mapper \u652f\u6301\u7684\u6240\u6709\u914d\u7f6e\u8bf7\u770b\u540e\u7eed\u7684\u6587\u6863\u3002\u003C/p\u003E\n\u003Ch5\u003E\u003Ca class=\"anchor\" id=\"1-3-2-mapperscan-\u6ce8\u89e3\u914d\u7f6e_1\" href=\"#1-3-2-mapperscan-\u6ce8\u89e3\u914d\u7f6e_1\"\u003E\u003C/a\u003E1.3.2  \u003Ccode\u003E@MapperScan\u003C/code\u003E \u6ce8\u89e3\u914d\u7f6e\u003C/h5\u003E\n\u003Cp\u003E\u4f60\u53ef\u4ee5\u7ed9\u5e26\u6709 \u003Ccode\u003E@Configuration\u003C/code\u003E \u7684\u7c7b\u914d\u7f6e\u8be5\u6ce8\u89e3\uff0c\u6216\u8005\u76f4\u63a5\u914d\u7f6e\u5230 Spring Boot \u7684\u542f\u52a8\u7c7b\u4e0a\uff0c\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nd\"\u003E@tk\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Emybatis\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Espring\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eannotation\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EMapperScan\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EbasePackages\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"s\"\u003E\"\u626b\u63cf\u5305\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n\u003Cspan class=\"nd\"\u003E@SpringBootApplication\u003C/span\u003E\n\u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eclass\u003C/span\u003E \u003Cspan class=\"nc\"\u003ESampleMapperApplication\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eimplements\u003C/span\u003E \u003Cspan class=\"n\"\u003ECommandLineRunner\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003E\u6ce8\u610f\uff1a\u8fd9\u91cc\u4f7f\u7528\u7684 \u003Ccode\u003Etk.mybatis.spring.annotation.MapperScan\u003C/code\u003E !\u003C/strong\u003E\u003C/p\u003E\n\n\u003Cp\u003E\u4f60\u53ef\u4ee5\u76f4\u63a5\u5728 Spring Boot \u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u76f4\u63a5\u914d\u7f6e\u901a\u7528 Mapper\uff08\u53c2\u80031.3.1\u4e2d\u7684\u914d\u7f6e\uff09\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528\u6ce8\u89e3\u4e2d\u63d0\u4f9b\u7684\u4e24\u4e2a\u5c5e\u6027\u8fdb\u884c\u914d\u7f6e\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"cm\"\u003E/**\n * \u901a\u7528 Mapper \u7684\u914d\u7f6e\uff0c\u4e00\u884c\u4e00\u4e2a\u914d\u7f6e\n *\n * @return\n */\u003C/span\u003E\n\u003Cspan class=\"n\"\u003EString\u003C/span\u003E\u003Cspan class=\"o\"\u003E[]\u003C/span\u003E \u003Cspan class=\"nf\"\u003Eproperties\u003C/span\u003E\u003Cspan class=\"o\"\u003E()\u003C/span\u003E \u003Cspan class=\"k\"\u003Edefault\u003C/span\u003E \u003Cspan class=\"o\"\u003E{};\u003C/span\u003E\n\n\u003Cspan class=\"cm\"\u003E/**\n * \u8fd8\u53ef\u4ee5\u76f4\u63a5\u914d\u7f6e\u4e00\u4e2a MapperHelper bean\n *\n * @return\n */\u003C/span\u003E\n\u003Cspan class=\"n\"\u003EString\u003C/span\u003E \u003Cspan class=\"nf\"\u003EmapperHelperRef\u003C/span\u003E\u003Cspan class=\"o\"\u003E()\u003C/span\u003E \u003Cspan class=\"k\"\u003Edefault\u003C/span\u003E \u003Cspan class=\"s\"\u003E\"\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u4f7f\u7528\u8fd9\u79cd\u65b9\u5f0f\u8fdb\u884c\u914d\u7f6e\u65f6\uff0c\u8bf7\u53c2\u8003 1.2.2.2 \u4e2d\u7684\u5185\u5bb9\u3002\u003C/p\u003E\n\n\u003Cblockquote\u003E\n\u003Cp\u003E\u6ce8\u610f\uff1a\u8fd9\u4e24\u4e2a\u5c5e\u6027\u914d\u7f6e\u65b9\u5f0f\u7684\u4f18\u5148\u7ea7\u66f4\u9ad8\uff0c\u6240\u4ee5\u5efa\u8bae\u5728 Spring Boot \u4e2d\u901a\u8fc7\u914d\u7f6e\u6587\u4ef6\uff08\u6216 Environment\uff09\u914d\u7f6e\u3002\u003C/p\u003E\n\u003C/blockquote\u003E\n\n\u003Cp\u003E\u63a5\u4e0b\u6765\u8bf7\u7ee7\u7eed\u770b\u4e0b\u4e00\u7ae0\u5185\u5bb9\u3002\u003C/p\u003E\n","208199":"\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"\u4e00-\u96c6\u6210\u901a\u7528-mapper_1\" href=\"#\u4e00-\u96c6\u6210\u901a\u7528-mapper_1\"\u003E\u003C/a\u003E\u4e00\u3001\u96c6\u6210\u901a\u7528 Mapper\u003C/h2\u003E\n\u003Cp\u003E\u901a\u7528 Mapper \u6709\u5f88\u591a\u79cd\u96c6\u6210\u65b9\u5f0f\uff0c\u8fd9\u91cc\u4f1a\u4ecb\u7ecd\u5927\u90e8\u5206\u60c5\u51b5\u4e0b\u7684\u914d\u7f6e\u65b9\u5f0f\u3002\u003C/p\u003E\n\n\u003Cp\u003EJava \u7f16\u7801\u65b9\u5f0f\u96c6\u6210\u662f\u6700\u5c11\u89c1\u7684\u4e00\u79cd\u60c5\u51b5\uff0c\u4f46\u662f\u901a\u8fc7\u8fd9\u79cd\u96c6\u6210\u65b9\u5f0f\u53ef\u4ee5\u5f88\u5bb9\u6613\u8ba9\u5927\u5bb6\u770b\u6e05\u901a\u7528 Mapper \u96c6\u6210\u7684\u5165\u53e3\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u548c Spring \u96c6\u6210\u662f\u6700\u5e38\u89c1\u7684\uff0cSpring Boot \u4e5f\u5728\u6162\u6162\u6210\u4e3a\u4e3b\u6d41\uff0c\u4e3a\u4e86\u4fbf\u4e8e\u5728\u96c6\u6210\u901a\u7528 Mapper \u7684\u60c5\u51b5\u4e0b\u4ecd\u7136\u53ef\u4ee5\u548c\u7b2c\u4e09\u65b9\u7684\u5de5\u5177\u96c6\u6210\uff0c\u8fd9\u91cc\u4e5f\u4f1a\u6709\u5f88\u591a\u79cd\u96c6\u6210\u7684\u65b9\u5f0f\u3002\u003C/p\u003E\n\n\u003Chr\u003E\n\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"1-1-java-\u7f16\u7801\u65b9\u5f0f\u96c6\u6210_3\" href=\"#1-1-java-\u7f16\u7801\u65b9\u5f0f\u96c6\u6210_3\"\u003E\u003C/a\u003E\u003Ca href=\"1.1-java\" class=\"md_relative_url\"\u003E1.1 Java \u7f16\u7801\u65b9\u5f0f\u96c6\u6210\u003C/a\u003E\u003C/h3\u003E\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"1-2-spring-\u96c6\u6210_3\" href=\"#1-2-spring-\u96c6\u6210_3\"\u003E\u003C/a\u003E\u003Ca href=\"1.2-spring\" class=\"md_relative_url\"\u003E1.2 Spring \u96c6\u6210\u003C/a\u003E\u003C/h3\u003E\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"1-3-spring-boot-\u96c6\u6210_3\" href=\"#1-3-spring-boot-\u96c6\u6210_3\"\u003E\u003C/a\u003E\u003Ca href=\"1.3-spring-boot\" class=\"md_relative_url\"\u003E1.3 Spring Boot \u96c6\u6210\u003C/a\u003E\u003C/h3\u003E","208201":"\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"2-1-\u7b80\u5355\u793a\u4f8b_1\" href=\"#2-1-\u7b80\u5355\u793a\u4f8b_1\"\u003E\u003C/a\u003E2.1 \u7b80\u5355\u793a\u4f8b\u003C/h3\u003E\n\u003Cp\u003E\u793a\u4f8b\u9488\u5bf9 MySql \u6570\u636e\u5e93\uff08\u6570\u636e\u5e93\u5bf9\u4e3b\u952e\u5f71\u54cd\u8f83\u5927\uff0c\u548c insert \u5173\u7cfb\u5bc6\u5207\uff09\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u6570\u636e\u5e93\u6709\u5982\u4e0b\u8868\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"k\"\u003ECREATE\u003C/span\u003E \u003Cspan class=\"k\"\u003ETABLE\u003C/span\u003E \u003Cspan class=\"nv\"\u003E`country`\u003C/span\u003E \u003Cspan class=\"p\"\u003E(\u003C/span\u003E\n  \u003Cspan class=\"nv\"\u003E`id`\u003C/span\u003E \u003Cspan class=\"n\"\u003Eint\u003C/span\u003E\u003Cspan class=\"p\"\u003E(\u003C/span\u003E\u003Cspan class=\"mi\"\u003E11\u003C/span\u003E\u003Cspan class=\"p\"\u003E)\u003C/span\u003E \u003Cspan class=\"k\"\u003ENOT\u003C/span\u003E \u003Cspan class=\"k\"\u003ENULL\u003C/span\u003E \u003Cspan class=\"n\"\u003EAUTO_INCREMENT\u003C/span\u003E \u003Cspan class=\"k\"\u003ECOMMENT\u003C/span\u003E \u003Cspan class=\"s1\"\u003E'\u4e3b\u952e'\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E\n  \u003Cspan class=\"nv\"\u003E`countryname`\u003C/span\u003E \u003Cspan class=\"n\"\u003Evarchar\u003C/span\u003E\u003Cspan class=\"p\"\u003E(\u003C/span\u003E\u003Cspan class=\"mi\"\u003E255\u003C/span\u003E\u003Cspan class=\"p\"\u003E)\u003C/span\u003E \u003Cspan class=\"k\"\u003EDEFAULT\u003C/span\u003E \u003Cspan class=\"k\"\u003ENULL\u003C/span\u003E \u003Cspan class=\"k\"\u003ECOMMENT\u003C/span\u003E \u003Cspan class=\"s1\"\u003E'\u540d\u79f0'\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E\n  \u003Cspan class=\"nv\"\u003E`countrycode`\u003C/span\u003E \u003Cspan class=\"n\"\u003Evarchar\u003C/span\u003E\u003Cspan class=\"p\"\u003E(\u003C/span\u003E\u003Cspan class=\"mi\"\u003E255\u003C/span\u003E\u003Cspan class=\"p\"\u003E)\u003C/span\u003E \u003Cspan class=\"k\"\u003EDEFAULT\u003C/span\u003E \u003Cspan class=\"k\"\u003ENULL\u003C/span\u003E \u003Cspan class=\"k\"\u003ECOMMENT\u003C/span\u003E \u003Cspan class=\"s1\"\u003E'\u4ee3\u7801'\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E\n  \u003Cspan class=\"k\"\u003EPRIMARY\u003C/span\u003E \u003Cspan class=\"k\"\u003EKEY\u003C/span\u003E \u003Cspan class=\"p\"\u003E(\u003C/span\u003E\u003Cspan class=\"nv\"\u003E`Id`\u003C/span\u003E\u003Cspan class=\"p\"\u003E)\u003C/span\u003E\n\u003Cspan class=\"p\"\u003E)\u003C/span\u003E \u003Cspan class=\"n\"\u003EENGINE\u003C/span\u003E\u003Cspan class=\"o\"\u003E=\u003C/span\u003E\u003Cspan class=\"n\"\u003EInnoDB\u003C/span\u003E \u003Cspan class=\"n\"\u003EAUTO_INCREMENT\u003C/span\u003E\u003Cspan class=\"o\"\u003E=\u003C/span\u003E\u003Cspan class=\"mi\"\u003E10011\u003C/span\u003E \u003Cspan class=\"k\"\u003EDEFAULT\u003C/span\u003E \u003Cspan class=\"n\"\u003ECHARSET\u003C/span\u003E\u003Cspan class=\"o\"\u003E=\u003C/span\u003E\u003Cspan class=\"n\"\u003Eutf8\u003C/span\u003E \u003Cspan class=\"k\"\u003ECOMMENT\u003C/span\u003E\u003Cspan class=\"o\"\u003E=\u003C/span\u003E\u003Cspan class=\"s1\"\u003E'\u56fd\u5bb6\u4fe1\u606f'\u003C/span\u003E\u003Cspan class=\"p\"\u003E;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u5bf9\u5e94\u7684 Java \u5b9e\u4f53\u7c7b\u578b\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eclass\u003C/span\u003E \u003Cspan class=\"nc\"\u003ECountry\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n    \u003Cspan class=\"nd\"\u003E@Id\u003C/span\u003E\n    \u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"n\"\u003EInteger\u003C/span\u003E \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n    \u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"n\"\u003EString\u003C/span\u003E  \u003Cspan class=\"n\"\u003Ecountryname\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n    \u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"n\"\u003EString\u003C/span\u003E  \u003Cspan class=\"n\"\u003Ecountrycode\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n\n    \u003Cspan class=\"c1\"\u003E//\u7701\u7565 getter \u548c setter\u003C/span\u003E\n\u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u6700\u7b80\u5355\u7684\u60c5\u51b5\u4e0b\uff0c\u53ea\u9700\u8981\u4e00\u4e2a \u003Ccode\u003E@Id\u003C/code\u003E \u6807\u8bb0\u5b57\u6bb5\u4e3a\u4e3b\u952e\u5373\u53ef\u3002\u6570\u636e\u5e93\u4e2d\u7684\u5b57\u6bb5\u540d\u548c\u5b9e\u4f53\u7c7b\u7684\u5b57\u6bb5\u540d\u662f\u5b8c\u5168\u76f8\u540c\u7684\uff0c\u8fd9\u4e2d\u60c5\u51b5\u4e0b\u5b9e\u4f53\u548c\u8868\u53ef\u4ee5\u76f4\u63a5\u6620\u5c04\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u003Cstrong\u003E\u63d0\u9192\uff1a\u5982\u679c\u5b9e\u4f53\u7c7b\u4e2d\u6ca1\u6709\u4e00\u4e2a\u6807\u8bb0 \u003Ccode\u003E@Id\u003C/code\u003E \u7684\u5b57\u6bb5\uff0c\u5f53\u4f60\u4f7f\u7528\u5e26\u6709 \u003Ccode\u003EByPrimaryKey\u003C/code\u003E \u7684\u65b9\u6cd5\u65f6\uff0c\u6240\u6709\u7684\u5b57\u6bb5\u4f1a\u4f5c\u4e3a\u8054\u5408\u4e3b\u952e\u6765\u4f7f\u7528\uff0c\u4e5f\u5c31\u4f1a\u51fa\u73b0\u7c7b\u4f3c \u003Ccode\u003Ewhere id = ? and countryname = ? and countrycode = ?\u003C/code\u003E \u7684\u60c5\u51b5\u3002\u003C/strong\u003E\u003C/p\u003E\n\n\u003Cblockquote\u003E\n\u003Cp\u003E\u7b2c\u56db\u7ae0\u4f1a\u4ecb\u7ecd\u4ee3\u7801\u751f\u6210\u5668\uff0c\u53ef\u4ee5\u81ea\u52a8\u751f\u6210\u4e0a\u9762\u7684\u5b9e\u4f53\u548c\u4e0b\u9762\u7684\u63a5\u53e3\u4ee3\u7801\u003C/p\u003E\n\u003C/blockquote\u003E\n\n\u003Cp\u003E\u003Cstrong\u003E\u901a\u7528 Mapper \u63d0\u4f9b\u4e86\u5927\u91cf\u7684\u901a\u7528\u63a5\u53e3\uff0c\u8fd9\u91cc\u4ee5\u6700\u5e38\u7528\u7684 Mapper \u63a5\u53e3\u4e3a\u4f8b\u003C/strong\u003E\u003C/p\u003E\n\n\u003Cp\u003E\u8be5\u5b9e\u4f53\u7c7b\u5bf9\u5e94\u7684\u6570\u636e\u5e93\u64cd\u4f5c\u63a5\u53e3\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"kn\"\u003Eimport\u003C/span\u003E \u003Cspan class=\"nn\"\u003Etk.mybatis.mapper.common.Mapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n\n\u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kd\"\u003Einterface\u003C/span\u003E \u003Cspan class=\"nc\"\u003ECountryMapper\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eextends\u003C/span\u003E \u003Cspan class=\"n\"\u003EMapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n\u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003E\u53ea\u8981\u914d\u7f6e MyBatis \u65f6\u80fd\u6ce8\u518c\u6216\u8005\u626b\u63cf\u5230\u8be5\u63a5\u53e3\uff0c\u8be5\u63a5\u53e3\u63d0\u4f9b\u7684\u65b9\u6cd5\u5c31\u90fd\u53ef\u4ee5\u4f7f\u7528\u3002\u003C/p\u003E\n\u003C/blockquote\u003E\n\n\u003Cp\u003E\u8be5\u63a5\u53e3\u9ed8\u8ba4\u7ee7\u627f\u7684\u65b9\u6cd5\u5982\u4e0b\uff1a\u003C/p\u003E\n\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u003Cem\u003EselectOne\u003C/em\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cem\u003Eselect\u003C/em\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cem\u003EselectAll\u003C/em\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cem\u003EselectCount\u003C/em\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cem\u003EselectByPrimaryKey\u003C/em\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cem\u003E\u65b9\u6cd5\u592a\u591a\uff0c\u7701\u7565\u5176\u4ed6...\u003C/em\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\n\u003Cp\u003E\u4ece MyBatis \u4e2d\u83b7\u53d6\u8be5\u63a5\u53e3\u540e\u5c31\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"c1\"\u003E//\u4ece MyBatis \u6216\u8005 Spring \u4e2d\u83b7\u53d6 countryMapper\uff0c\u7136\u540e\u8c03\u7528 selectAll \u65b9\u6cd5\u003C/span\u003E\n\u003Cspan class=\"n\"\u003EList\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountries\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003EcountryMapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EselectAll\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n\u003Cspan class=\"c1\"\u003E//\u6839\u636e\u4e3b\u952e\u67e5\u8be2\u003C/span\u003E\n\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountry\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003EcountryMapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EselectByPrimaryKey\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"mi\"\u003E1\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"c1\"\u003E//\u6216\u8005\u4f7f\u7528\u5bf9\u8c61\u4f20\u53c2\uff0c\u9002\u7528\u4e8e1\u4e2a\u5b57\u6bb5\u6216\u8005\u591a\u4e2a\u5b57\u6bb5\u8054\u5408\u4e3b\u952e\u4f7f\u7528\u003C/span\u003E\n\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E \u003Cspan class=\"n\"\u003Equery\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"k\"\u003Enew\u003C/span\u003E \u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n\u003Cspan class=\"n\"\u003Equery\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EsetId\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"mi\"\u003E1\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"n\"\u003Ecountry\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003EcountryMapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EselectByPrimaryKey\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Equery\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003E\u5982\u679c\u60f3\u8981\u589e\u52a0\u81ea\u5df1\u5199\u7684\u65b9\u6cd5\uff0c\u53ef\u4ee5\u76f4\u63a5\u5728 \u003Ccode\u003ECountryMapper\u003C/code\u003E \u4e2d\u589e\u52a0\u3002\u003C/strong\u003E\u003C/p\u003E\n\n\u003Cp\u003E\u003Cstrong\u003E1. \u4f7f\u7528\u7eaf\u63a5\u53e3\u6ce8\u89e3\u65b9\u5f0f\u65f6\u003C/strong\u003E\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"kn\"\u003Eimport\u003C/span\u003E \u003Cspan class=\"nn\"\u003Eorg.apache.ibatis.annotations.Select\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n\u003Cspan class=\"kn\"\u003Eimport\u003C/span\u003E \u003Cspan class=\"nn\"\u003Etk.mybatis.mapper.common.Mapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n\n\u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kd\"\u003Einterface\u003C/span\u003E \u003Cspan class=\"nc\"\u003ECountryMapper\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eextends\u003C/span\u003E \u003Cspan class=\"n\"\u003EMapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n    \u003Cspan class=\"nd\"\u003E@Select\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"select * from country where countryname = #{countryname}\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n    \u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E \u003Cspan class=\"nf\"\u003EselectByCountryName\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EString\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountryname\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003E\u8fd9\u91cc\u53ea\u662f\u4e3e\u4e86\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\uff0c\u53ef\u4ee5\u662f\u5f88\u590d\u6742\u7684\u67e5\u8be2\u3002\u003C/p\u003E\n\u003C/blockquote\u003E\n\n\u003Cp\u003E\u003Cstrong\u003E2. \u5982\u679c\u4f7f\u7528 XML \u65b9\u5f0f\uff0c\u9700\u8981\u63d0\u4f9b\u63a5\u53e3\u5bf9\u5e94\u7684 XML \u6587\u4ef6\u003C/strong\u003E\u003C/p\u003E\n\n\u003Cp\u003E\u4f8b\u5982\u63d0\u4f9b\u4e86 \u003Ccode\u003ECountryMapper.xml\u003C/code\u003E \u6587\u4ef6\uff0c\u5185\u5bb9\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"cp\"\u003E\u0026lt;!DOCTYPE mapper\n        PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\"\n        \"http://mybatis.org/dtd/mybatis-3-mapper.dtd\"\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;mapper\u003C/span\u003E \u003Cspan class=\"na\"\u003Enamespace=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"tk.mybatis.sample.mapper.CountryMapper\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"nt\"\u003E\u0026lt;select\u003C/span\u003E \u003Cspan class=\"na\"\u003Eid=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"selectByCountryName\"\u003C/span\u003E \u003Cspan class=\"na\"\u003EresultType=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"tk.mybatis.model.Country\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E\u0026gt;\u003C/span\u003E\n        select * from country where countryname = #{countryname}\n    \u003Cspan class=\"nt\"\u003E\u0026lt;/select\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/mapper\u0026gt;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u5728\u63a5\u53e3\u4e2d\u6dfb\u52a0\u5bf9\u5e94\u7684\u65b9\u6cd5\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"kn\"\u003Eimport\u003C/span\u003E \u003Cspan class=\"nn\"\u003Etk.mybatis.mapper.common.Mapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n\n\u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kd\"\u003Einterface\u003C/span\u003E \u003Cspan class=\"nc\"\u003ECountryMapper\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eextends\u003C/span\u003E \u003Cspan class=\"n\"\u003EMapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n    \u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E \u003Cspan class=\"nf\"\u003EselectByCountryName\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EString\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountryname\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u5728\u63a5\u53e3\u4e2d\u6dfb\u52a0\u5176\u4ed6\u65b9\u6cd5\u7684\u65f6\u5019\u548c\u53ea\u7528 MyBatis \u662f\u5b8c\u5168\u4e00\u6837\u7684\uff0c\u003Cstrong\u003E\u4f46\u662f\u9700\u8981\u6ce8\u610f\uff0c\u5728\u5bf9\u5e94\u7684 XML \u4e2d\uff0c\u4e0d\u80fd\u51fa\u73b0\u548c\u7ee7\u627f\u63a5\u53e3\u4e2d\u540c\u540d\u7684\u65b9\u6cd5\uff01\u003C/strong\u003E\u003C/p\u003E\n\n\u003Cblockquote\u003E\n\u003Cp\u003E\u003Cstrong\u003E\u591a\u6001\uff01\u003C/strong\u003E\u003C/p\u003E\n\n\u003Cp\u003E\u5728\u63a5\u53e3\u4e2d\uff0c\u53ea\u8981\u4e0d\u662f\u901a\u8fc7\u6ce8\u89e3\u6765\u5b9e\u73b0\u63a5\u53e3\u65b9\u6cd5\uff0c\u63a5\u53e3\u662f\u5141\u8bb8\u91cd\u540d\u7684\uff0c\u771f\u6b63\u8c03\u7528\u4f1a\u4f7f\u7528\u901a\u7528 Mapper \u63d0\u4f9b\u7684\u65b9\u6cd5\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u4f8b\u5982\u5728\u4e0a\u9762 CountryMapper \u4e2d\u63d0\u4f9b\u4e00\u4e2a\u5e26\u5206\u9875\u7684 selectAll \u65b9\u6cd5\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E  \u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kd\"\u003Einterface\u003C/span\u003E \u003Cspan class=\"nc\"\u003ECountryMapper\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eextends\u003C/span\u003E \u003Cspan class=\"n\"\u003EMapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n      \u003Cspan class=\"n\"\u003EList\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"nf\"\u003EselectAll\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003ERowBounds\u003C/span\u003E \u003Cspan class=\"n\"\u003ErowBounds\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n  \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u5728 Java 8 \u7684\u63a5\u53e3\u4e2d\u901a\u8fc7\u9ed8\u8ba4\u65b9\u6cd5\u8fd8\u80fd\u589e\u52a0\u4e00\u4e9b\u7b80\u5355\u7684\u95f4\u63a5\u8c03\u7528\u65b9\u6cd5\uff0c\u4f8b\u5982\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E  \u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kd\"\u003Einterface\u003C/span\u003E \u003Cspan class=\"nc\"\u003ECountryMapper\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eextends\u003C/span\u003E \u003Cspan class=\"n\"\u003EMapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n      \u003Cspan class=\"c1\"\u003E//\u8fd9\u4e2a\u793a\u4f8b\u9002\u5408\u53c2\u8003\u5b9e\u73b0\u5bf9\u4e50\u89c2\u9501\u65b9\u6cd5\u5c01\u88c5\u003C/span\u003E\n      \u003Cspan class=\"k\"\u003Edefault\u003C/span\u003E \u003Cspan class=\"kt\"\u003Evoid\u003C/span\u003E \u003Cspan class=\"nf\"\u003EupdateSuccess\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E){\u003C/span\u003E\n          \u003Cspan class=\"n\"\u003EAssert\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EassertEquals\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"mi\"\u003E1\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E \u003Cspan class=\"n\"\u003EupdateByPrimaryKey\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Ecountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E));\u003C/span\u003E\n      \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n  \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003E\u5728\u4e0d\u719f\u6089 Java \u8bed\u8a00\u548c MyBatis \u7279\u6027\u524d\uff0c\u4e0d\u8981\u8f7b\u6613\u4f7f\u7528\uff01\u003C/strong\u003E\u003C/p\u003E\n\u003C/blockquote\u003E\n","208202":"\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"2-2-\u6570\u636e\u5e93\u6620\u5c04_1\" href=\"#2-2-\u6570\u636e\u5e93\u6620\u5c04_1\"\u003E\u003C/a\u003E2.2 \u6570\u636e\u5e93\u6620\u5c04\u003C/h3\u003E\n\u003Cp\u003E\u5728 2.1 \u4e2d\u770b\u5230\u7684\u662f\u6700\u7b80\u5355\u7684\u60c5\u51b5\uff0c\u5b9e\u9645\u4f7f\u7528\u8fc7\u7a0b\u4e2d\u4e5f\u4e0d\u4f1a\u66f4\u590d\u6742\uff0c\u4e0b\u9762\u662f\u66f4\u8be6\u7ec6\u7684\u6620\u5c04\u914d\u7f6e\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u003Cstrong\u003E\u901a\u7528 Mapper \u4e2d\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u662f\u5c06\u5b9e\u4f53\u7c7b\u5b57\u6bb5\u6309\u7167\u9a7c\u5cf0\u8f6c\u4e0b\u5212\u7ebf\u5f62\u5f0f\u7684\u8868\u540d\u5217\u540d\u8fdb\u884c\u8f6c\u6362\u3002\u003C/strong\u003E\u003C/p\u003E\n\n\u003Cblockquote\u003E\n\u003Cp\u003E\u4f8b\u5982 \u003C/p\u003E\n\n\u003Cp\u003E\u5b9e\u4f53\u7c7b\u7684 \u003Ccode\u003EuserName\u003C/code\u003E \u53ef\u4ee5\u6620\u5c04\u5230\u8868\u7684 \u003Ccode\u003Euser_name\u003C/code\u003E \u4e0a\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u5982\u679c\u60f3\u8981\u4fee\u6539\u9ed8\u8ba4\u7684\u8f6c\u6362\u65b9\u5f0f\uff0c\u53ef\u4ee5\u5728\u540e\u7eed\u7684\u914d\u7f6e\u4e2d\uff0c\u4fee\u6539 \u003Ccode\u003Estyle\u003C/code\u003E \u5168\u5c40\u914d\u7f6e\u3002\u003C/p\u003E\n\u003C/blockquote\u003E\n\n\u003Cp\u003E\u6570\u636e\u5e93\u6620\u5c04\u4e3b\u8981\u6d89\u53ca\u5230\u4e00\u4e9b\u6ce8\u89e3\u548c\u5168\u5c40\u914d\u7f6e\uff0c\u8fd9\u4e00\u8282\u4e2d\u4f1a\u4ecb\u7ecd\u6240\u6709\u6ce8\u89e3\uff0c\u540e\u9762\u7ae0\u8282\u4f1a\u6709\u914d\u7f6e\u7684\u4ecb\u7ecd\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u901a\u7528 Mapper \u9ed8\u8ba4\u4f7f\u7528\u4e86\u51e0\u4e2a\u7b80\u5355\u7684\u6ce8\u89e3\uff0c\u5176\u4ed6 JPA \u7684\u6ce8\u89e3\u9ed8\u8ba4\u5e76\u4e0d\u652f\u6301\uff0c\u4f46\u662f\u5982\u679c\u4f60\u5f00\u53d1\u81ea\u5df1\u7684\u901a\u7528\u65b9\u6cd5\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528 JPA \u6ce8\u89e3\u6216\u8005\u5f15\u5165\u81ea\u5df1\u7684\u6ce8\u89e3\u3002\u003C/p\u003E\n\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"2-2-1-namestyle-\u6ce8\u89e3-mapper-_1\" href=\"#2-2-1-namestyle-\u6ce8\u89e3-mapper-_1\"\u003E\u003C/a\u003E2.2.1\u003Ccode\u003E@NameStyle\u003C/code\u003E \u6ce8\u89e3\uff08Mapper\uff09\u003C/h4\u003E\n\u003Cp\u003E\u8fd9\u4e2a\u6ce8\u89e3\u53ef\u4ee5\u5728\u7c7b\u4e0a\u8fdb\u884c\u914d\u7f6e\uff0c\u4f18\u5148\u7ea7\u9ad8\u4e8e\u5bf9\u5e94\u7684 \u003Ccode\u003Estyle\u003C/code\u003E \u5168\u5c40\u914d\u7f6e\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u6ce8\u89e3\u652f\u6301\u4ee5\u4e0b\u51e0\u4e2a\u9009\u9879\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003Enormal,                     //\u539f\u503c\ncamelhump,                  //\u9a7c\u5cf0\u8f6c\u4e0b\u5212\u7ebf\nuppercase,                  //\u8f6c\u6362\u4e3a\u5927\u5199\nlowercase,                  //\u8f6c\u6362\u4e3a\u5c0f\u5199\ncamelhumpAndUppercase,      //\u9a7c\u5cf0\u8f6c\u4e0b\u5212\u7ebf\u5927\u5199\u5f62\u5f0f\ncamelhumpAndLowercase,      //\u9a7c\u5cf0\u8f6c\u4e0b\u5212\u7ebf\u5c0f\u5199\u5f62\u5f0f\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u4f7f\u7528\u65f6\uff0c\u76f4\u63a5\u5728\u7c7b\u4e0a\u914d\u7f6e\u5373\u53ef\uff0c\u4f8b\u5982\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nd\"\u003E@NameStyle\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EStyle\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EcamelhumpAndUppercase\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n\u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eclass\u003C/span\u003E \u003Cspan class=\"nc\"\u003ECountry\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u914d\u7f6e\u8be5\u6ce8\u89e3\u540e\uff0c\u5bf9\u8be5\u7c7b\u548c\u5176\u4e2d\u7684\u5b57\u6bb5\u8fdb\u884c\u8f6c\u6362\u65f6\uff0c\u4f1a\u5c06\u5f62\u5982 \u003Ccode\u003EuserName\u003C/code\u003E \u7684\u5b57\u6bb5\u8f6c\u6362\u4e3a\u8868\u4e2d\u7684 \u003Ccode\u003EUSER_NAME\u003C/code\u003E \u5b57\u6bb5\u3002\u003C/p\u003E\n\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"2-2-2-table-\u6ce8\u89e3-jpa-_1\" href=\"#2-2-2-table-\u6ce8\u89e3-jpa-_1\"\u003E\u003C/a\u003E2.2.2 \u003Ccode\u003E@Table\u003C/code\u003E \u6ce8\u89e3\uff08JPA\uff09\u003C/h4\u003E\n\u003Cp\u003E\u003Ccode\u003E@Table\u003C/code\u003E \u6ce8\u89e3\u53ef\u4ee5\u914d\u7f6e \u003Ccode\u003Ename\u003C/code\u003E,\u003Ccode\u003Ecatalog\u003C/code\u003E \u548c \u003Ccode\u003Eschema\u003C/code\u003E \u4e09\u4e2a\u5c5e\u6027\uff0c\u914d\u7f6e \u003Ccode\u003Ename\u003C/code\u003E \u5c5e\u6027\u540e\uff0c\u76f4\u63a5\u4f7f\u7528\u63d0\u4f9b\u7684\u8868\u540d\uff0c\u4e0d\u518d\u6839\u636e\u5b9e\u4f53\u7c7b\u540d\u8fdb\u884c\u8f6c\u6362\u3002\u5176\u4ed6\u4e24\u4e2a\u5c5e\u6027\u4e2d\uff0c\u540c\u65f6\u914d\u7f6e\u65f6\uff0c\u003Ccode\u003Ecatalog\u003C/code\u003E \u4f18\u5148\u7ea7\u9ad8\u4e8e \u003Ccode\u003Eschema\u003C/code\u003E\uff0c\u4e5f\u5c31\u662f\u53ea\u6709 \u003Ccode\u003Ecatalog\u003C/code\u003E \u4f1a\u751f\u6548\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u914d\u7f6e\u793a\u4f8b\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nd\"\u003E@Table\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Ename\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"s\"\u003E\"sys_user\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n\u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eclass\u003C/span\u003E \u003Cspan class=\"nc\"\u003EUser\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u5c06 \u003Ccode\u003EUser\u003C/code\u003E \u5b9e\u4f53\u6620\u5c04\u5230 \u003Ccode\u003Esys_user\u003C/code\u003E \u8868\u3002\u003C/p\u003E\n\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"2-2-3-column-\u6ce8\u89e3-jpa-_1\" href=\"#2-2-3-column-\u6ce8\u89e3-jpa-_1\"\u003E\u003C/a\u003E2.2.3 \u003Ccode\u003E@Column\u003C/code\u003E \u6ce8\u89e3\uff08JPA\uff09\u003C/h4\u003E\n\u003Cp\u003E\u003Ccode\u003E@Column\u003C/code\u003E \u6ce8\u89e3\u652f\u6301 \u003Ccode\u003Ename\u003C/code\u003E, \u003Ccode\u003Einsertable\u003C/code\u003E \u548c \u003Ccode\u003Eupdateable\u003C/code\u003E \u4e09\u4e2a\u5c5e\u6027\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u003Ccode\u003Ename\u003C/code\u003E \u914d\u7f6e\u6620\u5c04\u7684\u5217\u540d\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u003Ccode\u003Einsertable\u003C/code\u003E \u5bf9\u63d0\u4f9b\u7684 \u003Ccode\u003Einsert\u003C/code\u003E \u65b9\u6cd5\u6709\u6548\uff0c\u5982\u679c\u8bbe\u7f6e \u003Ccode\u003Efalse\u003C/code\u003E \u5c31\u4e0d\u4f1a\u51fa\u73b0\u5728 SQL \u4e2d\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u003Ccode\u003Eupdateable\u003C/code\u003E \u5bf9\u63d0\u4f9b\u7684 \u003Ccode\u003Eupdate\u003C/code\u003E \u65b9\u6cd5\u6709\u6548\uff0c\u8bbe\u7f6e\u4e3a \u003Ccode\u003Efalse\u003C/code\u003E \u540e\u4e0d\u4f1a\u51fa\u73b0\u5728 SQL \u4e2d\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u914d\u7f6e\u793a\u4f8b\u5982\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nd\"\u003E@Column\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Ename\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"s\"\u003E\"user_name\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n\u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"n\"\u003EString\u003C/span\u003E \u003Cspan class=\"n\"\u003Ename\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u9664\u4e86\u76f4\u63a5\u6620\u5c04 \u003Ccode\u003Ename\u003C/code\u003E \u5230 \u003Ccode\u003Euser_name\u003C/code\u003E \u8fd9\u79cd\u7528\u6cd5\u5916\uff0c\u5728\u4f7f\u7528\u5173\u952e\u5b57\u7684\u60c5\u51b5\uff0c\u8fd8\u4f1a\u6709\u4e0b\u9762\u7684\u7528\u6cd5\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nd\"\u003E@Column\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Ename\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"s\"\u003E\"`order`\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n\u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"n\"\u003EString\u003C/span\u003E \u003Cspan class=\"n\"\u003Eorder\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u5bf9\u4e8e\u5173\u952e\u5b57\u8fd9\u79cd\u60c5\u51b5\uff0c\u901a\u7528 Mapper \u652f\u6301\u81ea\u52a8\u8f6c\u6362\uff0c\u53ef\u4ee5\u67e5\u770b\u540e\u7eed\u914d\u7f6e\u6587\u6863\u4e2d\u7684 \u003Cstrong\u003EwrapKeyword\u003C/strong\u003E \u914d\u7f6e\u3002\u003C/p\u003E\n\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"2-2-4-columntype-\u6ce8\u89e3-mapper-_1\" href=\"#2-2-4-columntype-\u6ce8\u89e3-mapper-_1\"\u003E\u003C/a\u003E2.2.4 \u003Ccode\u003E@ColumnType\u003C/code\u003E \u6ce8\u89e3\uff08Mapper\uff09\u003C/h4\u003E\n\u003Cp\u003E\u8fd9\u4e2a\u6ce8\u89e3\u63d0\u4f9b\u7684 \u003Ccode\u003Ecolumn\u003C/code\u003E\u5c5e\u6027\u548c \u003Ccode\u003E@Column\u003C/code\u003E \u4e2d\u7684 \u003Ccode\u003Ename\u003C/code\u003E \u4f5c\u7528\u76f8\u540c\u3002\u4f46\u662f \u003Ccode\u003E@Column\u003C/code\u003E \u7684\u4f18\u5148\u7ea7\u66f4\u9ad8\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u9664\u4e86 \u003Ccode\u003Ename\u003C/code\u003E \u5c5e\u6027\u5916\uff0c\u8fd9\u4e2a\u6ce8\u89e3\u4e3b\u8981\u63d0\u4f9b\u4e86  \u003Ccode\u003EjdbcType\u003C/code\u003E \u5c5e\u6027\u548c \u003Ccode\u003EtypeHandler\u003C/code\u003E \u5c5e\u6027\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u003Ccode\u003EjdbcType\u003C/code\u003E \u7528\u4e8e\u8bbe\u7f6e\u7279\u6b8a\u6570\u636e\u5e93\u7c7b\u578b\u65f6\u6307\u5b9a\u6570\u636e\u5e93\u4e2d\u7684 \u003Ccode\u003EjdbcType\u003C/code\u003E\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u003Ccode\u003EtypeHandler\u003C/code\u003E \u7528\u4e8e\u8bbe\u7f6e\u7279\u6b8a\u7c7b\u578b\u5904\u7406\u5668\uff0c\u5e38\u89c1\u7684\u662f\u679a\u4e3e\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u7528\u6cd5\u793a\u4f8b\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nd\"\u003E@ColumnType\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003Ecolumn\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"s\"\u003E\"countryname\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003EjdbcType\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003EJdbcType\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EVARCHAR\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003EtypeHandler\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003EStringTypeHandler\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eclass\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n\u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"n\"\u003EString\u003C/span\u003E  \u003Cspan class=\"n\"\u003Ecountryname\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"2-2-5-transient-\u6ce8\u89e3-jpa-_1\" href=\"#2-2-5-transient-\u6ce8\u89e3-jpa-_1\"\u003E\u003C/a\u003E2.2.5 \u003Ccode\u003E@Transient\u003C/code\u003E \u6ce8\u89e3\uff08JPA\uff09\u003C/h4\u003E\n\u003Cp\u003E\u4e00\u822c\u60c5\u51b5\u4e0b\uff0c\u5b9e\u4f53\u4e2d\u7684\u5b57\u6bb5\u548c\u6570\u636e\u5e93\u8868\u4e2d\u7684\u5b57\u6bb5\u662f\u4e00\u4e00\u5bf9\u5e94\u7684\uff0c\u4f46\u662f\u4e5f\u6709\u5f88\u591a\u60c5\u51b5\u6211\u4eec\u4f1a\u5728\u5b9e\u4f53\u4e2d\u589e\u52a0\u4e00\u4e9b\u989d\u5916\u7684\u5c5e\u6027\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u5c31\u9700\u8981\u4f7f\u7528  \u003Ccode\u003E@Transient\u003C/code\u003E \u6ce8\u89e3\u6765\u544a\u8bc9\u901a\u7528 Mapper \u8fd9\u4e0d\u662f\u8868\u4e2d\u7684\u5b57\u6bb5\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u6709\u7b80\u5355\u7c7b\u578b\u4f1a\u88ab\u81ea\u52a8\u8ba4\u4e3a\u662f\u8868\u4e2d\u7684\u5b57\u6bb5\uff08\u53ef\u4ee5\u901a\u8fc7\u914d\u7f6e\u4e2d\u7684 \u003Cstrong\u003E\u003Ccode\u003EuseSimpleType\u003C/code\u003E\u003C/strong\u003E \u63a7\u5236\uff09\u3002\u003C/p\u003E\n\n\u003Cblockquote\u003E\n\u003Cp\u003E\u8fd9\u91cc\u7684\u7b80\u5355\u7c7b\u578b\u4e0d\u5305\u542b Java \u4e2d\u76848\u79cd\u57fa\u672c\u7c7b\u578b\uff1a\u003C/p\u003E\n\n\u003Cp\u003Ebyte,short,int,long,float,double,char,boolean\u003C/p\u003E\n\n\u003Cp\u003E\u8fd9\u662f\u56e0\u4e3a\u5728\u7c7b\u4e2d\uff0c\u57fa\u672c\u7c7b\u578b\u4f1a\u6709\u9ed8\u8ba4\u503c\uff0c\u800c MyBatis \u4e2d\u7ecf\u5e38\u4f1a\u9700\u8981\u5224\u65ad\u5c5e\u6027\u503c\u662f\u5426\u4e3a\u7a7a\uff0c\u6240\u4ee5\u4e0d\u8981\u5728\u7c7b\u4e2d\u4f7f\u7528\u57fa\u672c\u7c7b\u578b\uff0c\u5426\u5219\u4f1a\u9047\u5230\u83ab\u540d\u5176\u5999\u7684\u9519\u8bef\u3002\u003C/p\u003E\n\u003C/blockquote\u003E\n\n\u003Cp\u003E\u5bf9\u4e8e\u7c7b\u4e2d\u7684\u590d\u6742\u5bf9\u8c61\uff0c\u4ee5\u53ca \u003Ccode\u003EMap\u003C/code\u003E,\u003Ccode\u003EList\u003C/code\u003E \u7b49\u5c5e\u6027\u4e0d\u9700\u8981\u914d\u7f6e\u8fd9\u4e2a\u6ce8\u89e3\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u5bf9\u4e8e\u679a\u4e3e\u7c7b\u578b\u4f5c\u4e3a\u6570\u636e\u5e93\u5b57\u6bb5\u7684\u60c5\u51b5\uff0c\u9700\u8981\u770b\u914d\u7f6e\u4e2d\u7684 \u003Cstrong\u003E\u003Ccode\u003EenumAsSimpleType\u003C/code\u003E\u003C/strong\u003E \u53c2\u6570\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u914d\u7f6e\u793a\u4f8b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nd\"\u003E@Transient\u003C/span\u003E\n\u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"n\"\u003EString\u003C/span\u003E \u003Cspan class=\"n\"\u003EotherThings\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E \u003Cspan class=\"c1\"\u003E//\u975e\u6570\u636e\u5e93\u8868\u4e2d\u5b57\u6bb5\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"2-2-6-id-\u6ce8\u89e3-jpa-_1\" href=\"#2-2-6-id-\u6ce8\u89e3-jpa-_1\"\u003E\u003C/a\u003E2.2.6 \u003Ccode\u003E@Id\u003C/code\u003E \u6ce8\u89e3\uff08JPA\uff09\u003C/h4\u003E\n\u003Cp\u003E\u4e0a\u9762\u51e0\u4e2a\u6ce8\u89e3\u90fd\u6d89\u53ca\u5230\u6620\u5c04\u3002 \u003Ccode\u003E@Id\u003C/code\u003E \u6ce8\u89e3\u548c\u6620\u5c04\u65e0\u5173\uff0c\u5b83\u662f\u4e00\u4e2a\u7279\u6b8a\u7684\u6807\u8bb0\uff0c\u7528\u4e8e\u6807\u8bc6\u6570\u636e\u5e93\u4e2d\u7684\u4e3b\u952e\u5b57\u6bb5\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u6b63\u5e38\u60c5\u51b5\u4e0b\uff0c\u003Cstrong\u003E\u4e00\u4e2a\u5b9e\u4f53\u7c7b\u4e2d\u81f3\u5c11\u9700\u8981\u4e00\u4e2a\u6807\u8bb0 \u003Ccode\u003E@Id\u003C/code\u003E \u6ce8\u89e3\u7684\u5b57\u6bb5\uff0c\u5b58\u5728\u8054\u5408\u4e3b\u952e\u65f6\u53ef\u4ee5\u6807\u8bb0\u591a\u4e2a\u3002\u003C/strong\u003E\u003C/p\u003E\n\n\u003Cp\u003E\u5982\u679c\u8868\u4e2d\u6ca1\u6709\u4e3b\u952e\uff0c\u7c7b\u4e2d\u5c31\u53ef\u4ee5\u4e0d\u6807\u8bb0\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u5f53\u7c7b\u4e2d\u6ca1\u6709\u5b58\u5728\u6807\u8bb0 \u003Ccode\u003E@Id\u003C/code\u003E \u6ce8\u89e3\u7684\u5b57\u6bb5\u65f6\uff0c\u4f60\u53ef\u4ee5\u7406\u89e3\u4e3a\u7c7b\u4e2d\u7684\u003Cstrong\u003E\u6240\u6709\u5b57\u6bb5\u662f\u8054\u5408\u4e3b\u952e\u003C/strong\u003E\u3002\u4f7f\u7528\u6240\u6709\u7684 \u003Ccode\u003EByPrimaryKey\u003C/code\u003E \u76f8\u5173\u7684\u65b9\u6cd5\u65f6\uff0c\u6709 \u003Ccode\u003Ewhere\u003C/code\u003E \u6761\u4ef6\u7684\u5730\u65b9\uff0c\u4f1a\u5c06\u6240\u6709\u5217\u4f5c\u4e3a\u6761\u4ef6\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u914d\u7f6e\u793a\u4f8b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nd\"\u003E@Id\u003C/span\u003E\n\u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"n\"\u003EInteger\u003C/span\u003E \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u6216\u8005\u8054\u5408\u4e3b\u952e\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nd\"\u003E@Id\u003C/span\u003E\n\u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"n\"\u003EInteger\u003C/span\u003E \u003Cspan class=\"n\"\u003EuserId\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n\u003Cspan class=\"nd\"\u003E@Id\u003C/span\u003E\n\u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"n\"\u003EInteger\u003C/span\u003E \u003Cspan class=\"n\"\u003EroleId\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"2-2-7-generatedvalue-\u6ce8\u89e3-jpa-_1\" href=\"#2-2-7-generatedvalue-\u6ce8\u89e3-jpa-_1\"\u003E\u003C/a\u003E2.2.7 \u003Ccode\u003E@GeneratedValue\u003C/code\u003E \u6ce8\u89e3\uff08JPA\uff09\u003C/h4\u003E\n\u003Cp\u003E\u4e3b\u952e\u7b56\u7565\u6ce8\u89e3\uff0c\u7528\u4e8e\u914d\u7f6e\u5982\u4f55\u751f\u6210\u4e3b\u952e\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u7531\u4e8e\u4e0d\u540c\u7c7b\u578b\u6570\u636e\u5e93\u7684\u914d\u7f6e\u4e0d\u540c\uff0c\u6240\u4ee5\u540e\u9762\u6709\u4e00\u8282\u4e13\u95e8\u4ecb\u7ecd\u8be5\u6ce8\u89e3\u7684\u6587\u6863\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u5173\u4e8e\u8be5\u6ce8\u89e3\u7684\u7528\u6cd5\u53ef\u4ee5\u67e5\u770b \u003Cstrong\u003E2.3 \u4e3b\u952e\u7b56\u7565\u003C/strong\u003E\u3002\u003C/p\u003E\n\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"2-2-8-version-\u6ce8\u89e3-mapper-_1\" href=\"#2-2-8-version-\u6ce8\u89e3-mapper-_1\"\u003E\u003C/a\u003E2.2.8 \u003Ccode\u003E@Version\u003C/code\u003E \u6ce8\u89e3\uff08Mapper\uff09\u003C/h4\u003E\n\u003Cp\u003E\u003Ccode\u003E@Version\u003C/code\u003E \u662f\u5b9e\u73b0\u4e50\u89c2\u9501\u7684\u4e00\u4e2a\u6ce8\u89e3\uff0c\u5927\u591a\u6570\u4eba\u90fd\u4e0d\u9700\u8981\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u9700\u8981\u4f7f\u7528\u8be5\u6ce8\u89e3\u7684\u8bf7\u770b \u003Cstrong\u003E2.4 \u4e50\u89c2\u9501\u003C/strong\u003E\u3002\u003C/p\u003E\n\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"2-2-9-registermapper-\u6ce8\u89e3_1\" href=\"#2-2-9-registermapper-\u6ce8\u89e3_1\"\u003E\u003C/a\u003E2.2.9 \u003Ccode\u003E@RegisterMapper\u003C/code\u003E \u6ce8\u89e3\u003C/h4\u003E\n\u003Cp\u003E\u4e3a\u4e86\u89e3\u51b3\u901a\u7528 Mapper \u4e2d\u6700\u5e38\u89c1\u7684\u4e00\u4e2a\u9519\u8bef\u800c\u589e\u52a0\u7684\u6807\u8bb0\u6ce8\u89e3\uff0c\u8be5\u6ce8\u89e3\u4ec5\u7528\u4e8e\u5f00\u53d1\u7684\u901a\u7528\u63a5\u53e3\uff0c\u4e0d\u662f\u5b9e\u4f53\u7c7b\u4e0a\u4f7f\u7528\u7684\uff0c\u8fd9\u91cc\u548c\u5176\u4ed6\u6ce8\u89e3\u4e00\u8d77\u4ecb\u7ecd\u4e86\u3002\u003C/p\u003E\n\n\u003Cp\u003E4.0 \u7248\u672c\u63d0\u4f9b\u7684\u6240\u6709\u901a\u7528\u63a5\u53e3\u4e0a\u90fd\u6807\u8bb0\u4e86\u8be5\u6ce8\u89e3\uff0c\u56e0\u6b64\u81ea\u5e26\u7684\u901a\u7528\u63a5\u53e3\u65f6\uff0c\u4e0d\u9700\u8981\u914d\u7f6e \u003Ccode\u003Emappers\u003C/code\u003E \u53c2\u6570\uff0c\u8be5\u6ce8\u89e3\u7684\u5177\u4f53\u7528\u6cd5\u4f1a\u5728 \u003Cstrong\u003E\u7b2c\u4e94\u7ae0 \u6269\u5c55\u901a\u7528\u63a5\u53e3\u003C/strong\u003E \u4e2d\u4ecb\u7ecd\u3002\u003C/p\u003E\n\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"2-2-10-\u81ea\u5b9a\u4e49\u6ce8\u89e3_1\" href=\"#2-2-10-\u81ea\u5b9a\u4e49\u6ce8\u89e3_1\"\u003E\u003C/a\u003E2.2.10 \u81ea\u5b9a\u4e49\u6ce8\u89e3\u003C/h4\u003E\n\u003Cp\u003E\u003Cem\u003E\u8fd9\u90e8\u5206\u63d0\u4f9b\u7ed9\u60f3\u8981\u5f00\u53d1\u901a\u7528\u65b9\u6cd5\u7684\u670b\u53cb\uff0c\u5982\u679c\u53ea\u662f\u4f7f\u7528\uff0c\u4e0d\u9700\u8981\u9605\u8bfb\u8fd9\u90e8\u5206\u5185\u5bb9\u3002\u003C/em\u003E\u003C/p\u003E\n\n\u003Cp\u003E\u5728\u901a\u7528 Mapper \u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7 \u003Ccode\u003EEntityHelper.getColumns(entityClass)\u003C/code\u003E \u65b9\u6cd5\u6765\u83b7\u53d6\u5b9e\u4f53\u7c7b\u7684\u5168\u90e8\u4fe1\u606f\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u5728 \u003Ccode\u003EEntityColumn\u003C/code\u003E \u4e2d\uff0c\u901a\u8fc7\u4e0b\u9762\u7684\u4ee3\u7801\u53ef\u4ee5\u83b7\u53d6\u5b57\u6bb5\u4e0a\u7684\u4efb\u610f\u6ce8\u89e3\u3002\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"c1\"\u003E//\u5224\u65ad\u662f\u5426\u6709\u67d0\u4e2a\u6ce8\u89e3\u003C/span\u003E\n\u003Cspan class=\"kt\"\u003Eboolean\u003C/span\u003E \u003Cspan class=\"n\"\u003EhasVersion\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecolumn\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EgetEntityField\u003C/span\u003E\u003Cspan class=\"o\"\u003E().\u003C/span\u003E\u003Cspan class=\"na\"\u003EisAnnotationPresent\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EVersion\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eclass\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n\u003Cspan class=\"c1\"\u003E//\u901a\u8fc7\u4e0b\u9762\u7684\u4ee3\u7801\u53ef\u4ee5\u83b7\u53d6\u6ce8\u89e3\u4fe1\u606f\u003C/span\u003E\n\u003Cspan class=\"n\"\u003EVersion\u003C/span\u003E \u003Cspan class=\"n\"\u003Eversion\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecolumn\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EgetEntityField\u003C/span\u003E\u003Cspan class=\"o\"\u003E().\u003C/span\u003E\u003Cspan class=\"na\"\u003EgetAnnotation\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EVersion\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eclass\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u5728\u5b9e\u73b0\u81ea\u5df1\u7684\u901a\u7528\u65b9\u5f0f\u65f6\uff0c\u53ef\u4ee5\u6839\u636e\u9700\u8981\u6765\u589e\u52a0\u989d\u5916\u7684\u6ce8\u89e3\u6765\u5b9e\u73b0\u4e00\u4e9b\u5176\u4ed6\u7684\u7528\u9014\u3002\u003C/p\u003E\n","208203":"\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"2-3-\u4e3b\u952e\u7b56\u7565_1\" href=\"#2-3-\u4e3b\u952e\u7b56\u7565_1\"\u003E\u003C/a\u003E2.3 \u4e3b\u952e\u7b56\u7565\u003C/h3\u003E\n\u003Cp\u003E\u5728 2.2 \u4e2d\u4ecb\u7ecd\u4e86\u6240\u6709\u5176\u4ed6\u6ce8\u89e3\u7684\u4f5c\u7528\u548c\u7528\u6cd5\uff0c\u7531\u4e8e\u4e3b\u952e\u7b56\u7565\u6bd4\u8f83\u590d\u6742\uff0c\u5355\u72ec\u7528\u4e00\u8282\u6765\u9610\u8ff0\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u9996\u5148\u4e3b\u952e\u7b56\u7565\u548c\u6570\u636e\u5e93\u5173\u7cfb\u5f88\u5927\uff0c\u6709\u4e9b\u6570\u636e\u5e93\u652f\u6301\u4e3b\u952e\u81ea\u589e\uff0c\u800c\u6709\u4e9b\u6570\u636e\u5e93\u53ea\u80fd\u901a\u8fc7\u5e8f\u5217\u6765\u83b7\u5f97\u3002\u003C/p\u003E\n\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"2-3-1-jdbc-\u652f\u6301\u901a\u8fc7-getgeneratedkeys-\u65b9\u6cd5\u53d6\u56de\u4e3b\u952e\u7684\u60c5\u51b5_1\" href=\"#2-3-1-jdbc-\u652f\u6301\u901a\u8fc7-getgeneratedkeys-\u65b9\u6cd5\u53d6\u56de\u4e3b\u952e\u7684\u60c5\u51b5_1\"\u003E\u003C/a\u003E2.3.1 JDBC \u652f\u6301\u901a\u8fc7 \u003Ccode\u003EgetGeneratedKeys\u003C/code\u003E \u65b9\u6cd5\u53d6\u56de\u4e3b\u952e\u7684\u60c5\u51b5\u003C/h4\u003E\n\u003Cp\u003E\u8fd9\u79cd\u60c5\u51b5\u9996\u5148\u9700\u8981\u6570\u636e\u5e93\u652f\u6301\u81ea\u589e\uff0c\u5176\u6b21\u6570\u636e\u5e93\u63d0\u4f9b\u7684 JDBC \u652f\u6301 \u003Ccode\u003EgetGeneratedKeys\u003C/code\u003E \u65b9\u6cd5\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u5e38\u89c1\u7684\u5982 MySql\uff0cSqlServer \u652f\u6301\u8fd9\u79cd\u6a21\u5f0f\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u914d\u7f6e\u4e3b\u952e\u7b56\u7565\u6700\u7b80\u5355\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u7528\u6cd5\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nd\"\u003E@Id\u003C/span\u003E\n\u003Cspan class=\"nd\"\u003E@GeneratedValue\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Egenerator\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"s\"\u003E\"JDBC\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n\u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"n\"\u003ELong\u003C/span\u003E \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u4e3a\u4e86\u8ba9\u5927\u5bb6\u5bb9\u6613\u7406\u89e3\u8fd9\u91cc\u914d\u7f6e\u548c MyBatis \u5199\u6cd5\u7684\u5173\u7cfb\uff0c\u5927\u5bb6\u53ef\u4ee5\u770b\u770b\u5bf9\u5e94\u751f\u6210\u7684 XML \u4ee3\u7801\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nt\"\u003E\u0026lt;insert\u003C/span\u003E \u003Cspan class=\"na\"\u003Eid=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"insert\"\u003C/span\u003E \u003Cspan class=\"na\"\u003EuseGeneratedKeys=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"true\"\u003C/span\u003E \u003Cspan class=\"na\"\u003EkeyProperty=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"id\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E\u0026gt;\u003C/span\u003E\n    insert into country (id, countryname, countrycode)\n    values (#{id},#{countryname},#{countrycode})\n\u003Cspan class=\"nt\"\u003E\u0026lt;/insert\u0026gt;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003ESqlServer \u4e2d\u4f7f\u7528\u65f6\uff0c\u9700\u8981\u8bbe\u7f6e id \u7684 \u003Ccode\u003Einsertable=false\u003C/code\u003E \u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"2-3-2-\u652f\u6301\u81ea\u589e\u7684\u6570\u636e\u5e93_1\" href=\"#2-3-2-\u652f\u6301\u81ea\u589e\u7684\u6570\u636e\u5e93_1\"\u003E\u003C/a\u003E2.3.2 \u652f\u6301\u81ea\u589e\u7684\u6570\u636e\u5e93\u003C/h4\u003E\n\u003Cp\u003E\u652f\u6301\u81ea\u589e\u7684\u6570\u636e\u5e93\u5217\u8868\u5982\u4e0b\uff1a\u003C/p\u003E\n\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\n\u003Cstrong\u003EDB2\u003C/strong\u003E: \u003Ccode\u003EVALUES IDENTITY_VAL_LOCAL()\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\n\u003Cstrong\u003EMYSQL\u003C/strong\u003E: \u003Ccode\u003ESELECT LAST_INSERT_ID()\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\n\u003Cstrong\u003ESQLSERVER\u003C/strong\u003E: \u003Ccode\u003ESELECT SCOPE_IDENTITY()\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\n\u003Cstrong\u003ECLOUDSCAPE\u003C/strong\u003E: \u003Ccode\u003EVALUES IDENTITY_VAL_LOCAL()\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\n\u003Cstrong\u003EDERBY\u003C/strong\u003E: \u003Ccode\u003EVALUES IDENTITY_VAL_LOCAL()\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\n\u003Cstrong\u003EHSQLDB\u003C/strong\u003E: \u003Ccode\u003ECALL IDENTITY()\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\n\u003Cstrong\u003ESYBASE\u003C/strong\u003E: \u003Ccode\u003ESELECT @@IDENTITY\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\n\u003Cstrong\u003EDB2_MF\u003C/strong\u003E: \u003Ccode\u003ESELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\n\u003Cstrong\u003EINFORMIX\u003C/strong\u003E: \u003Ccode\u003Eselect dbinfo(\u0026#39;sqlca.sqlerrd1\u0026#39;) from systables where tabid=1\u003C/code\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\n\u003Cblockquote\u003E\n\u003Cp\u003E\u8fd9\u4e2a\u5217\u8868\u53ea\u662f\u5217\u4e3e\u4e86\u6bd4\u8f83\u5e38\u89c1\u7684\u6570\u636e\u5e93\uff0c\u5176\u4ed6\u7c7b\u4f3c\u7684\u4e5f\u652f\u6301\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u5217\u8868\u6570\u636e\u5e93\u540d\u5b57\u540e\u9762\u5bf9\u5e94\u7684 SQL \u662f\u63d2\u5165\u540e\u003Cstrong\u003E\u53d6 id \u7684 SQL \u8bed\u53e5\u003C/strong\u003E\u3002\u003C/p\u003E\n\u003C/blockquote\u003E\n\n\u003Cp\u003E\u8fd9\u7c7b\u6570\u636e\u5e93\u4e3b\u952e\u7b56\u7565\u914d\u7f6e\u793a\u4f8b\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nd\"\u003E@Id\u003C/span\u003E\n\u003Cspan class=\"nd\"\u003E@GeneratedValue\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Estrategy\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003EGenerationType\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EIDENTITY\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n\u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"n\"\u003EInteger\u003C/span\u003E \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u9664\u6b64\u4e4b\u5916\uff0c\u8fd9\u79cd\u7528\u6cd5\u8fd8\u8981\u914d\u5408 \u003Cstrong\u003EIDENTITY\u003C/strong\u003E \u53c2\u6570\uff08\u4ee5\u53ca \u003Cstrong\u003EORDER\u003C/strong\u003E \u53c2\u6570\uff09\uff0c\u8fd9\u4e2a\u53c2\u6570\u503c\u9700\u8981\u914d\u7f6e\u4e3a\u5bf9\u5e94\u7684\u6570\u636e\u5e93\uff0c\u5c31\u662f\u4e0a\u9762\u5217\u8868\u4e2d\u7684\u540d\u5b57\uff0c\u5177\u4f53\u7684\u914d\u7f6e\u65b9\u6cd5\u770b\u540e\u9762\u7ae0\u8282\u7684\u5185\u5bb9\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u8fd9\u79cd\u914d\u7f6e\u5bf9\u5e94\u7684 XML \u5f62\u5f0f\u4e3a\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nt\"\u003E\u0026lt;insert\u003C/span\u003E \u003Cspan class=\"na\"\u003Eid=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"insertAuthor\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"nt\"\u003E\u0026lt;selectKey\u003C/span\u003E \u003Cspan class=\"na\"\u003EkeyProperty=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"id\"\u003C/span\u003E \u003Cspan class=\"na\"\u003EresultType=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"int\"\u003C/span\u003E \u003Cspan class=\"na\"\u003Eorder=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"AFTER\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E\u0026gt;\u003C/span\u003E\n      SELECT LAST_INSERT_ID()\n    \u003Cspan class=\"nt\"\u003E\u0026lt;/selectKey\u0026gt;\u003C/span\u003E\n    insert into country (id, countryname, countrycode)\n    values (#{id},#{countryname},#{countrycode})\n\u003Cspan class=\"nt\"\u003E\u0026lt;/insert\u0026gt;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003EIDENTITY\u003C/strong\u003E \u53c2\u6570\u4ee5\u53ca \u003Cstrong\u003EORDER\u003C/strong\u003E \u53c2\u6570\u4f1a\u51b3\u5b9a \u003Ccode\u003EselectKey\u003C/code\u003E \u4e2d\u7684 SQL \u548c \u003Ccode\u003Eorder\u003C/code\u003E \u5c5e\u6027\u7684\u503c\uff08\u8fd9\u91cc\u662f \u003Ccode\u003EAFTER\u003C/code\u003E\uff09\u3002\u003C/p\u003E\n\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"2-3-3-\u901a\u8fc7\u5e8f\u5217\u548c\u4efb\u610f-sql-\u83b7\u53d6\u4e3b\u952e\u503c_1\" href=\"#2-3-3-\u901a\u8fc7\u5e8f\u5217\u548c\u4efb\u610f-sql-\u83b7\u53d6\u4e3b\u952e\u503c_1\"\u003E\u003C/a\u003E2.3.3 \u901a\u8fc7\u5e8f\u5217\u548c\u4efb\u610f SQL \u83b7\u53d6\u4e3b\u952e\u503c\u003C/h4\u003E\n\u003Cp\u003E\u50cf Oracle \u4e2d\u901a\u8fc7\u5e8f\u5217\u83b7\u53d6\u4e3b\u952e\u5c31\u5c5e\u4e8e\u8fd9\u79cd\u60c5\u51b5\uff0c\u5b9e\u9645\u4e0a 2.3.2 \u4e2d\u7684 SQL \u4e5f\u53ef\u4ee5\u5728\u8fd9\u91cc\u914d\u7f6e\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u9664\u4e86\u7c7b\u4f3c\u5e8f\u5217\u83b7\u53d6\u503c\u5916\uff0c\u8fd8\u53ef\u4ee5\u662f\u83b7\u53d6 UUID \u7684 SQL \u8bed\u53e5\uff0c\u4f8b\u5982 \u003Ccode\u003Eselect uuid()\u003C/code\u003E\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u003Cstrong\u003E2.3.3 \u548c 2.3.2 \u7684\u533a\u522b\u4e3b\u8981\u5728\u4e8e\u003C/strong\u003E\uff0c2.3.2 \u662f\u63d2\u5165\u8868\u4e4b\u540e\u624d\u6709 id \u7684\u503c\uff0c2.3.3 \u662f\u63d2\u5165\u6570\u636e\u5e93\u524d\u9700\u8981\u83b7\u53d6\u4e00\u4e2a\u503c\u4f5c\u4e3a\u4e3b\u952e\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u5728 Oracle \u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u7528\u4e0b\u9762\u7684\u65b9\u5f0f\u8fdb\u884c\u914d\u7f6e\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nd\"\u003E@Id\u003C/span\u003E\n\u003Cspan class=\"nd\"\u003E@GeneratedValue\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\n  \u003Cspan class=\"n\"\u003Estrategy\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003EGenerationType\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EIDENTITY\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E\n  \u003Cspan class=\"n\"\u003Egenerator\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"s\"\u003E\"select SEQ_ID.nextval from dual\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n\u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"n\"\u003EInteger\u003C/span\u003E \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u9664\u6b64\u4e4b\u5916\u4e5f\u8981\u914d\u7f6e\u4e00\u4e2a \u003Cstrong\u003EORDER\u003C/strong\u003E \u5168\u5c40\u53c2\u6570\uff0c2.3.2 \u4e2d\u63d0\u5230\u7684 \u003Ccode\u003EAFTER\u003C/code\u003E\uff0c\u5728 2.3.3 \u4e2d\u9700\u8981\u914d\u7f6e\u4e3a \u003Ccode\u003EBEFORE\u003C/code\u003E\uff0c\u5177\u4f53\u914d\u7f6e\u65b9\u5f0f\u770b\u540e\u9762\u7ae0\u8282\u7684\u5185\u5bb9\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u8fd9\u79cd\u914d\u7f6e\u5bf9\u5e94\u7684 XML \u4ee3\u7801\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nt\"\u003E\u0026lt;insert\u003C/span\u003E \u003Cspan class=\"na\"\u003Eid=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"insertAuthor\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E\u0026gt;\u003C/span\u003E\n  \u003Cspan class=\"nt\"\u003E\u0026lt;selectKey\u003C/span\u003E \u003Cspan class=\"na\"\u003EkeyProperty=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"id\"\u003C/span\u003E \u003Cspan class=\"na\"\u003EresultType=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"int\"\u003C/span\u003E \u003Cspan class=\"na\"\u003Eorder=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"BEFORE\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E\u0026gt;\u003C/span\u003E\n    select SEQ_ID.nextval from dual\n  \u003Cspan class=\"nt\"\u003E\u0026lt;/selectKey\u0026gt;\u003C/span\u003E\n  insert into country (id, countryname, countrycode)\n  values (#{id},#{countryname},#{countrycode})\n\u003Cspan class=\"nt\"\u003E\u0026lt;/insert\u0026gt;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003E\u8fd9\u79cd\u7528\u6cd5\u4e2d\uff0c\u003Ccode\u003Evalues\u003C/code\u003E \u4e2d\u5fc5\u987b\u51fa\u73b0\u4e3b\u952e\u7684\u503c\uff0c\u5426\u5219\u5c31\u63d2\u4e0d\u5230\u6570\u636e\u5e93\u3002\u003C/p\u003E\n\u003C/blockquote\u003E\n\n\u003Cp\u003E\u9664\u4e86 Oracle \u8fd9\u79cd\u5916\uff0c\u8fd8\u6709\u4e00\u79cd\u66f4\u666e\u904d\u7684\u7528\u6cd5\uff0c\u5c31\u662f\u4f7f\u7528 UUID\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u4f8b\u5982\u4e0b\u9762\u7684\u914d\u7f6e\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nd\"\u003E@Id\u003C/span\u003E\n\u003Cspan class=\"nd\"\u003E@GeneratedValue\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Estrategy\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003EGenerationType\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EIDENTITY\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E\u003Cspan class=\"n\"\u003Egenerator\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"s\"\u003E\"select uuid()\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n\u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"n\"\u003EString\u003C/span\u003E \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003E\u6ce8\u610f SQL \u8fd4\u56de\u503c\u7c7b\u578b\u548c\u8fd9\u91cc\u63a5\u6536\u7684\u7c7b\u578b\uff08\u003Ccode\u003EString\u003C/code\u003E\uff09\u4e00\u81f4\u3002\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"2-3-4-todo-\u589e\u52a0\u4e00\u79cd\u65b0\u7684\u6ce8\u89e3-\u80fd\u591f\u72ec\u7acb\u914d\u7f6e-sql-\u548c-order_1\" href=\"#2-3-4-todo-\u589e\u52a0\u4e00\u79cd\u65b0\u7684\u6ce8\u89e3-\u80fd\u591f\u72ec\u7acb\u914d\u7f6e-sql-\u548c-order_1\"\u003E\u003C/a\u003E2.3.4 TODO \u589e\u52a0\u4e00\u79cd\u65b0\u7684\u6ce8\u89e3\uff0c\u80fd\u591f\u72ec\u7acb\u914d\u7f6e SQL \u548c ORDER\u003C/h4\u003E\n\u003Cp\u003E\u7531\u4e8e 2.3.2 \u548c 2.3.3 \u4e2d\u7684\u914d\u7f6e\u90fd\u4f9d\u8d56\u4e8e \u003Ccode\u003EORDER\u003C/code\u003E\uff0c\u5e76\u4e14\u8fd9\u4e24\u79cd\u60c5\u51b5\u4e0b\u7684\u503c\u76f8\u53cd\uff0c\u56e0\u6b64\u5982\u679c\u60f3\u8981\u540c\u65f6\u4f7f\u7528\u5c31\u4f1a\u51fa\u73b0\u95ee\u9898\uff0c\u56e0\u6b64\u63d0\u4f9b\u4e00\u4e2a\u65b0\u7684\u4e13\u7528\u6ce8\u89e3\u6765\u66ff\u4ee3 2.3.2 \u548c 2.3.3 \u662f\u5f88\u6709\u5fc5\u8981\u7684\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u8fd9\u4e2a\u529f\u80fd\u5f85\u5b9a\uff0c\u51c6\u5907\u5305\u542b\u5728 4.0 \u7248\u672c\u4e2d\u3002\u003C/p\u003E\n","208204":"\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"2-4-\u4e50\u89c2\u9501_1\" href=\"#2-4-\u4e50\u89c2\u9501_1\"\u003E\u003C/a\u003E2.4 \u4e50\u89c2\u9501\u003C/h3\u003E","208205":"\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"\u4e8c-\u5bf9\u8c61\u5173\u7cfb\u6620\u5c04_1\" href=\"#\u4e8c-\u5bf9\u8c61\u5173\u7cfb\u6620\u5c04_1\"\u003E\u003C/a\u003E\u4e8c\u3001\u5bf9\u8c61\u5173\u7cfb\u6620\u5c04\u003C/h2\u003E\n\u003Cp\u003E\u901a\u8fc7\u4e0a\u4e00\u7ae0\u7684\u6587\u6863\u96c6\u6210\u597d\u901a\u7528 Mapper \u540e\uff0c\u5c31\u53ef\u4ee5\u7ee7\u7eed\u770b\u8fd9\u91cc\u4e86\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u901a\u7528 Mapper \u4f7f\u7528 JPA \u6ce8\u89e3\u548c\u81ea\u5df1\u63d0\u4f9b\u7684\u6ce8\u89e3\u6765\u5b9e\u73b0\u5bf9\u8c61\u5173\u7cfb\u6620\u5c04\uff0c\u7531\u4e8e\u672c\u7ae0\u5305\u542b\u4e86\u5f88\u591a\u7ec6\u8282\uff0c\u6240\u4ee5\u901a\u8fc7\u7b80\u5355\u7684\u793a\u4f8b\u5148\u5f15\u9886\u5165\u95e8\uff0c\u7136\u540e\u5728\u4e00\u6b65\u6b65\u6df1\u5165\u53bb\u770b\u8be6\u7ec6\u7684\u914d\u7f6e\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u672c\u7ae0\u5305\u542b\u4e0b\u9762\u7684\u5185\u5bb9\uff0c\u8bf7\u6309\u7167\u987a\u5e8f\u9605\u8bfb\u3002\u003C/p\u003E\n\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"2-1-\u7b80\u5355\u793a\u4f8b-\u5fc5\u770b-_1\" href=\"#2-1-\u7b80\u5355\u793a\u4f8b-\u5fc5\u770b-_1\"\u003E\u003C/a\u003E\u003Ca href=\"2.1-simple\" class=\"md_relative_url\"\u003E2.1 \u7b80\u5355\u793a\u4f8b\uff08\u5fc5\u770b\uff09\u003C/a\u003E\u003C/h3\u003E\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"2-2-\u6570\u636e\u5e93\u6620\u5c04-\u5fc5\u770b-_1\" href=\"#2-2-\u6570\u636e\u5e93\u6620\u5c04-\u5fc5\u770b-_1\"\u003E\u003C/a\u003E\u003Ca href=\"2.2-mapping\" class=\"md_relative_url\"\u003E2.2 \u6570\u636e\u5e93\u6620\u5c04\uff08\u5fc5\u770b\uff09\u003C/a\u003E\u003C/h3\u003E\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"2-3-\u4e3b\u952e\u7b56\u7565-\u5fc5\u770b-_1\" href=\"#2-3-\u4e3b\u952e\u7b56\u7565-\u5fc5\u770b-_1\"\u003E\u003C/a\u003E\u003Ca href=\"2.3-generatedvalue\" class=\"md_relative_url\"\u003E2.3 \u4e3b\u952e\u7b56\u7565\uff08\u5fc5\u770b\uff09\u003C/a\u003E\u003C/h3\u003E\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"2-4-\u4e50\u89c2\u9501-\u53ef\u9009-_1\" href=\"#2-4-\u4e50\u89c2\u9501-\u53ef\u9009-_1\"\u003E\u003C/a\u003E\u003Ca href=\"2.4-version\" class=\"md_relative_url\"\u003E2.4 \u4e50\u89c2\u9501\uff08\u53ef\u9009\uff09\u003C/a\u003E\u003C/h3\u003E","208207":"\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"\u4e09-\u914d\u7f6e\u4ecb\u7ecd_1\" href=\"#\u4e09-\u914d\u7f6e\u4ecb\u7ecd_1\"\u003E\u003C/a\u003E\u4e09\u3001\u914d\u7f6e\u4ecb\u7ecd\u003C/h2\u003E\n\u003Cp\u003E\u7531\u4e8e\u6570\u636e\u5e93\u5b58\u5728\u5404\u79cd\u5404\u6837\u7684\u5dee\u5f02\uff0c\u56e0\u6b64\u6709\u4e9b\u65f6\u5019\u8981\u505a\u4e00\u4e9b\u5fc5\u8981\u7684\u914d\u7f6e\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u6b64\u5916\u901a\u7528 Mapper \u8fd8\u63d0\u4f9b\u4e86\u4e00\u4e9b\u63a7\u5236\u53c2\u6570\u548c\u4e00\u4e9b\u548c\u4e3b\u952e\u7b56\u7565\u76f8\u5173\u7684\u53c2\u6570\u3002\u003C/p\u003E\n\n\u003Cblockquote\u003E\n\u003Cp\u003E\u6587\u6863\u63d0\u4f9b\u7684\u53c2\u6570\u57fa\u4e8e 4.0 \u53ca\u4ee5\u540e\u7684\u7248\u672c\u003C/p\u003E\n\n\u003Cp\u003E\u6709\u4e9b\u53c2\u6570\u4ecd\u7136\u5b58\u5728\uff0c\u4f46\u662f\u7531\u4e8e\u4e0d\u63a8\u8350\u4f7f\u7528\uff0c\u8fd9\u91cc\u4e0d\u4f1a\u4ecb\u7ecd\uff08\u5982 UUID\uff09\u3002\u003C/p\u003E\n\u003C/blockquote\u003E\n\n\u003Cp\u003E\u003Cstrong\u003E\u63d0\u9192\uff1a\u770b\u914d\u7f6e\u524d\uff0c\u4e00\u5b9a\u8981\u770b\u7b2c\u4e8c\u7ae0\u7684\u5bf9\u8c61\u5173\u7cfb\u6620\u5c04\uff0c\u5426\u5219\u4e0d\u4f1a\u660e\u767d\u8fd9\u4e9b\u53c2\u6570\u7684\u7528\u9014\u3002\u003C/strong\u003E\u003C/p\u003E\n\n\u003Cp\u003E\u003Cstrong\u003E\u53c2\u6570\u7684\u914d\u7f6e\u65b9\u5f0f\u5728\u7b2c\u4e00\u7ae0\u4e2d\uff0c\u9488\u5bf9\u4e0d\u540c\u7684\u96c6\u6210\u73af\u5883\u90fd\u5199\u4e86\u8be6\u7ec6\u7684\u6587\u6863\u3002\u003C/strong\u003E\u003C/p\u003E\n\n\u003Cp\u003E\u901a\u7528 Mapper \u63d0\u4f9b\u4e86\u4e0b\u9762\u8fd9\u4e9b\u53c2\u6570\uff1a\u003C/p\u003E\n\n\u003Col class=\"task-list\"\u003E\n\u003Cli\u003E mappers\u003C/li\u003E\n\u003Cli\u003E IDENTITY\u003C/li\u003E\n\u003Cli\u003E ORDER\u003C/li\u003E\n\u003Cli\u003E catalog\u003C/li\u003E\n\u003Cli\u003E schema\u003C/li\u003E\n\u003Cli\u003E notEmpty\u003C/li\u003E\n\u003Cli\u003E style\u003C/li\u003E\n\u003Cli\u003E enableMethodAnnotation\u003C/li\u003E\n\u003Cli\u003E useSimpleType\u003C/li\u003E\n\u003Cli\u003E usePrimitiveType\u003C/li\u003E\n\u003Cli\u003E simpleTypes\u003C/li\u003E\n\u003Cli\u003E enumAsSimpleType\u003C/li\u003E\n\u003Cli\u003E wrapKeyword\u003C/li\u003E\n\u003Cli\u003E checkExampleEntityClass\u003C/li\u003E\n\u003Cli\u003E safeDelete\u003C/li\u003E\n\u003Cli\u003E useJavaType\u003C/li\u003E\n\u003C/ol\u003E\n\n\u003Cp\u003E\u4e0b\u9762\u5206\u522b\u5bf9\u8fd9\u4e9b\u53c2\u6570\u8fdb\u884c\u4ecb\u7ecd\u3002\u003C/p\u003E\n\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"3-1-mappers_1\" href=\"#3-1-mappers_1\"\u003E\u003C/a\u003E3.1 mappers\u003C/h3\u003E\n\u003Cp\u003E\u5728 4.0 \u4ee5\u524d\u8fd9\u662f\u4e00\u4e2a\u975e\u5e38\u91cd\u8981\u7684\u53c2\u6570\uff0c\u5f53\u65f6\u53ea\u6709\u901a\u8fc7 mappers \u914d\u7f6e\u8fc7\u7684\u63a5\u53e3\u624d\u80fd\u771f\u6b63\u8c03\u7528\uff0c\u7531\u4e8e\u5f88\u591a\u4eba\u4e0d\u6ce8\u610f\u770b\u6587\u6863\uff0c\u901a\u7528 Mapper 90% \u7684\u95ee\u9898\u90fd\u51fa\u5728\u8fd9\u4e2a\u53c2\u6570\u4e0a\u3002\u003C/p\u003E\n\n\u003Cp\u003E4.0 \u4e4b\u540e\uff0c\u589e\u52a0\u4e86\u4e00\u4e2a \u003Ccode\u003E@RegisterMapper\u003C/code\u003E \u6ce8\u89e3\uff0c\u901a\u7528 Mapper \u4e2d\u63d0\u4f9b\u7684\u6240\u6709\u63a5\u53e3\u90fd\u6709\u8fd9\u4e2a\u6ce8\u89e3\uff0c\u6709\u4e86\u8be5\u6ce8\u89e3\u540e\uff0c\u901a\u7528 Mapper \u4f1a\u81ea\u52a8\u89e3\u6790\u6240\u6709\u7684\u63a5\u53e3\uff0c\u5982\u679c\u7236\u63a5\u53e3\uff08\u9012\u5f52\u5411\u4e0a\u627e\u5230\u7684\u6700\u9876\u5c42\uff09\u5b58\u5728\u6807\u8bb0\u8be5\u6ce8\u89e3\u7684\u63a5\u53e3\uff0c\u5c31\u4f1a\u81ea\u52a8\u6ce8\u518c\u4e0a\u3002\u56e0\u6b64 4.0 \u540e\u4f7f\u7528\u901a\u7528 Mapper \u63d0\u4f9b\u7684\u65b9\u6cd5\u65f6\uff0c\u4e0d\u9700\u8981\u5728\u914d\u7f6e\u8fd9\u4e2a\u53c2\u6570\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u5f53\u4f60\u81ea\u5df1\u6269\u5c55\u901a\u7528\u63a5\u53e3\u65f6\uff0c\u5efa\u8bae\u52a0\u4e0a\u8be5\u6ce8\u89e3\uff0c\u5426\u5219\u5c31\u8981\u914d\u7f6e \u003Ccode\u003Emappers\u003C/code\u003E \u53c2\u6570\u3002\u003C/p\u003E\n\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"3-2-identity_1\" href=\"#3-2-identity_1\"\u003E\u003C/a\u003E3.2  IDENTITY\u003C/h3\u003E\n\u003Cp\u003E\u53d6\u56de\u4e3b\u952e\u7684\u65b9\u5f0f\uff0c\u53ef\u4ee5\u914d\u7f6e\u7684\u503c\u5982 2.3.2 \u4e2d\u6240\u5217\u7684\u6570\u636e\u5e93\u7c7b\u578b\uff1a\u003C/p\u003E\n\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E  \u003Cstrong\u003EDB2\u003C/strong\u003E: \u003Ccode\u003EVALUES IDENTITY_VAL_LOCAL()\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E  \u003Cstrong\u003EMYSQL\u003C/strong\u003E: \u003Ccode\u003ESELECT LAST_INSERT_ID()\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E  \u003Cstrong\u003ESQLSERVER\u003C/strong\u003E: \u003Ccode\u003ESELECT SCOPE_IDENTITY()\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E  \u003Cstrong\u003ECLOUDSCAPE\u003C/strong\u003E: \u003Ccode\u003EVALUES IDENTITY_VAL_LOCAL()\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E  \u003Cstrong\u003EDERBY\u003C/strong\u003E: \u003Ccode\u003EVALUES IDENTITY_VAL_LOCAL()\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E  \u003Cstrong\u003EHSQLDB\u003C/strong\u003E: \u003Ccode\u003ECALL IDENTITY()\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E  \u003Cstrong\u003ESYBASE\u003C/strong\u003E: \u003Ccode\u003ESELECT @@IDENTITY\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E  \u003Cstrong\u003EDB2_MF\u003C/strong\u003E: \u003Ccode\u003ESELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E  \u003Cstrong\u003EINFORMIX\u003C/strong\u003E: \u003Ccode\u003Eselect dbinfo(\u0026#39;sqlca.sqlerrd1\u0026#39;) from systables where tabid=1\u003C/code\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\n\u003Cp\u003E\u914d\u7f6e\u65f6\uff0c\u5199\u4e3a\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003EIDENTITY=MYSQL\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u8fd9\u4e2a\u53c2\u6570\u914d\u7f6e\u7684\u540c\u65f6\uff0c\u8fd8\u7ecf\u5e38\u4f34\u7740 3.2 \u4e2d\u7684 ORDER \u53c2\u6570\u3002\u003C/p\u003E\n\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"3-3-order_1\" href=\"#3-3-order_1\"\u003E\u003C/a\u003E3.3  ORDER\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003E\u0026lt;selectKey\u0026gt;\u003C/code\u003E\u4e2d\u7684\u003Ccode\u003Eorder\u003C/code\u003E\u5c5e\u6027\uff0c\u53ef\u9009\u503c\u4e3a\u003Ccode\u003EBEFORE\u003C/code\u003E\u548c\u003Ccode\u003EAFTER\u003C/code\u003E\u003C/p\u003E\n\n\u003Cp\u003E\u5728 3.1 \u7684\u914d\u7f6e\u4ee5\u53ca 2.3.2 \u548c 2.3.3 \u4e2d\u90fd\u63d0\u5230\u4e86\u8fd9\u4e2a\u53c2\u6570\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u5728\u652f\u6301\u4e3b\u952e\u9012\u589e\uff0c\u6ee1\u8db3 2.3.2 \u4e2d\u7684\u60c5\u51b5\u65f6\uff0c\u914d\u7f6e\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003EORDER=AFTER\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u5728\u7c7b\u4f3cOracle\u5e8f\u5217\u6216\u8005\u901a\u7528\u7684 UUID \u65f6\uff0c\u914d\u7f6e\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003EORDER=BEFORE\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"3-4-catalog_1\" href=\"#3-4-catalog_1\"\u003E\u003C/a\u003E3.4  catalog\u003C/h3\u003E\n\u003Cp\u003E\u6570\u636e\u5e93\u7684\u003Ccode\u003Ecatalog\u003C/code\u003E\uff0c\u5982\u679c\u8bbe\u7f6e\u8be5\u503c\uff0c\u67e5\u8be2\u7684\u65f6\u5019\u8868\u540d\u4f1a\u5e26\u003Ccode\u003Ecatalog\u003C/code\u003E\u8bbe\u7f6e\u7684\u524d\u7f00\u3002\u003C/p\u003E\n\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"3-5-schema_1\" href=\"#3-5-schema_1\"\u003E\u003C/a\u003E3.5  schema\u003C/h3\u003E\n\u003Cp\u003E\u540c\u003Ccode\u003Ecatalog\u003C/code\u003E\uff0c\u003Ccode\u003Ecatalog\u003C/code\u003E\u4f18\u5148\u7ea7\u9ad8\u4e8e\u003Ccode\u003Eschema\u003C/code\u003E\u3002\u003C/p\u003E\n\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"3-6-notempty_1\" href=\"#3-6-notempty_1\"\u003E\u003C/a\u003E3.6  notEmpty\u003C/h3\u003E\n\u003Cp\u003E\u003Ccode\u003EinsertSelective\u003C/code\u003E \u548c \u003Ccode\u003EupdateByPrimaryKeySelective\u003C/code\u003E \u4e2d\uff0c\u662f\u5426\u5224\u65ad\u5b57\u7b26\u4e32\u7c7b\u578b \u003Ccode\u003E!=\u0026#39;\u0026#39;\u003C/code\u003E\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u914d\u7f6e\u65b9\u5f0f\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003EnotEmpty=true\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"3-7-style_1\" href=\"#3-7-style_1\"\u003E\u003C/a\u003E3.7  style\u003C/h3\u003E\n\u003Cp\u003E\u5b9e\u4f53\u548c\u8868\u8f6c\u6362\u65f6\u7684\u9ed8\u8ba4\u89c4\u5219\uff0c\u5728 2.2 \u548c 2.2.1 \u4e2d\u90fd\u63d0\u5230\u4e86\u8fd9\u4e2a\u53c2\u6570\uff0c\u53ef\u9009\u503c\u5982\u4e0b\uff1a\u003C/p\u003E\n\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E  normal\uff1a\u539f\u503c\u003C/li\u003E\n\u003Cli\u003E  camelhump\uff1a\u9a7c\u5cf0\u8f6c\u4e0b\u5212\u7ebf\u003C/li\u003E\n\u003Cli\u003E  uppercase\uff1a\u8f6c\u6362\u4e3a\u5927\u5199\u003C/li\u003E\n\u003Cli\u003E  lowercase\uff1a\u8f6c\u6362\u4e3a\u5c0f\u5199\u003C/li\u003E\n\u003Cli\u003E  camelhumpAndUppercase\uff1a\u9a7c\u5cf0\u8f6c\u4e0b\u5212\u7ebf\u5927\u5199\u5f62\u5f0f\u003C/li\u003E\n\u003Cli\u003E  camelhumpAndLowercase\uff1a\u9a7c\u5cf0\u8f6c\u4e0b\u5212\u7ebf\u5c0f\u5199\u5f62\u5f0f\u003C/li\u003E\n\u003C/ul\u003E\n\n\u003Cp\u003E\u914d\u7f6e\u65b9\u5f0f\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003Estyle=camelhumpAndUppercase\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"3-8-enablemethodannotation_1\" href=\"#3-8-enablemethodannotation_1\"\u003E\u003C/a\u003E3.8  enableMethodAnnotation\u003C/h3\u003E\n\u003Cp\u003E\u53ef\u4ee5\u63a7\u5236\u662f\u5426\u652f\u6301\uff08getter \u548c setter\uff09\u5728\u65b9\u6cd5\u4e0a\u4f7f\u7528\u6ce8\u89e3\uff0c\u9ed8\u8ba4\u003Ccode\u003Efalse\u003C/code\u003E\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u914d\u7f6e\u65b9\u5f0f\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003EenableMethodAnnotation=true\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u542f\u7528\u540e\uff0c\u53ef\u4ee5\u6309\u7167\u4e0b\u9762\u65b9\u5f0f\u4f7f\u7528\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"n\"\u003EString\u003C/span\u003E \u003Cspan class=\"n\"\u003Ename\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n\n\u003Cspan class=\"nd\"\u003E@Column\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Ename\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"s\"\u003E\"user_name\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n\u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kt\"\u003Evoid\u003C/span\u003E \u003Cspan class=\"nf\"\u003EsetName\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EString\u003C/span\u003E \u003Cspan class=\"n\"\u003Ename\u003C/span\u003E\u003Cspan class=\"o\"\u003E){\u003C/span\u003E\n  \u003Cspan class=\"k\"\u003Ethis\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Ename\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003Ename\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n\u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"3-9-usesimpletype_1\" href=\"#3-9-usesimpletype_1\"\u003E\u003C/a\u003E3.9  useSimpleType\u003C/h3\u003E\n\u003Cp\u003E\u9ed8\u8ba4 \u003Ccode\u003Etrue\u003C/code\u003E\uff0c\u542f\u7528\u540e\u5224\u65ad\u5b9e\u4f53\u7c7b\u5c5e\u6027\u662f\u5426\u4e3a\u8868\u5b57\u6bb5\u65f6\u6821\u9a8c\u5b57\u6bb5\u662f\u5426\u4e3a\u7b80\u5355\u7c7b\u578b\uff0c\u5982\u679c\u4e0d\u662f\u5c31\u5ffd\u7565\u8be5\u5c5e\u6027\uff0c\u8fd9\u4e2a\u914d\u7f6e\u4f18\u5148\u7ea7\u9ad8\u4e8e\u6240\u6709\u6ce8\u89e3\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u003Cstrong\u003E\u6ce8\u610f\uff1abyte, short, int, long, float, double, char, boolean \u7531\u4e8e\u5b58\u5728\u9ed8\u8ba4\u503c\uff0c\u8fd9\u91cc\u4e0d\u4f1a\u4f5c\u4e3a\u7b80\u5355\u7c7b\u578b\u5bf9\u5f85\uff01\u4e5f\u5c31\u662f\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u8fd9\u4e9b\u5b57\u6bb5\u4e0d\u4f1a\u548c\u8868\u5b57\u6bb5\u8fdb\u884c\u6620\u5c04\u30022.2.5 \u4e2d\u4e5f\u5f3a\u8c03\u4e86\u8fd9\u4e00\u70b9\u3002\u003C/strong\u003E\u003C/p\u003E\n\n\u003Cp\u003E\u914d\u7f6e\u65b9\u5f0f\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003EuseSimpleType=true\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"3-10-useprimitivetype_1\" href=\"#3-10-useprimitivetype_1\"\u003E\u003C/a\u003E3.10  usePrimitiveType\u003C/h3\u003E\n\u003Cp\u003E\u4e3a\u4e86\u65b9\u4fbf\u90e8\u5206\u8fd8\u5728\u4f7f\u7528\u57fa\u672c\u7c7b\u578b\u7684\u5b9e\u4f53\uff0c\u589e\u52a0\u4e86\u8be5\u5c5e\u6027\uff0c\u53ea\u6709\u914d\u7f6e\u8be5\u5c5e\u6027\uff0c\u5e76\u4e14\u8bbe\u7f6e\u4e3a \u003Ccode\u003Etrue\u003C/code\u003E \u624d\u4f1a\u751f\u6548\uff0c\u542f\u7528\u540e\uff0c\u4f1a\u626b\u63cf 8 \u79cd\u57fa\u672c\u7c7b\u578b\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u914d\u7f6e\u65b9\u5f0f\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003EusePrimitiveType=true\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"3-11-simpletypes_1\" href=\"#3-11-simpletypes_1\"\u003E\u003C/a\u003E3.11 simpleTypes\u003C/h3\u003E\n\u003Cp\u003E\u9ed8\u8ba4\u7684\u7b80\u5355\u7c7b\u578b\u5728 \u003Ccode\u003ESimpleTypeUtil\u003C/code\u003E \u4e2d\uff0c\u4f7f\u7528\u8be5\u53c2\u6570\u53ef\u4ee5\u589e\u52a0\u989d\u5916\u7684\u7b80\u5355\u7c7b\u578b\uff0c\u901a\u8fc7\u9017\u53f7\u9694\u5f00\u7684\u5168\u9650\u5b9a\u7c7b\u540d\u6dfb\u52a0\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u914d\u7f6e\u65b9\u5f0f\u5982\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003EsimpleTypes=xxx.GenderEnum,xxx.JobEnum\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"3-12-enumassimpletype_1\" href=\"#3-12-enumassimpletype_1\"\u003E\u003C/a\u003E3.12  enumAsSimpleType\u003C/h3\u003E\n\u003Cp\u003E\u7528\u4e8e\u914d\u7f6e\u662f\u5426\u5c06\u679a\u4e3e\u7c7b\u578b\u5f53\u6210\u57fa\u672c\u7c7b\u578b\u5bf9\u5f85\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u9ed8\u8ba4 simpleType \u4f1a\u5ffd\u7565\u679a\u4e3e\u7c7b\u578b\uff0c\u4f7f\u7528 enumAsSimpleType \u914d\u7f6e\u540e\u4f1a\u628a\u679a\u4e3e\u6309\u7b80\u5355\u7c7b\u578b\u5904\u7406\uff0c\u9700\u8981\u81ea\u5df1\u914d\u7f6e\u597d \u003Ccode\u003EtypeHandler\u003C/code\u003E\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u914d\u7f6e\u65b9\u5f0f\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003EenumAsSimpleType=true\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"3-13-wrapkeyword_1\" href=\"#3-13-wrapkeyword_1\"\u003E\u003C/a\u003E3.13  wrapKeyword\u003C/h3\u003E\n\u003Cp\u003E\u914d\u7f6e\u540e\u4f1a\u81ea\u52a8\u5904\u7406\u5173\u952e\u5b57\uff0c\u53ef\u4ee5\u914d\u7684\u503c\u548c\u6570\u636e\u5e93\u6709\u5173\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u4f8b\u5982 sqlserver \u53ef\u4ee5\u914d\u7f6e\u4e3a \u003Ccode\u003E[{0}]\u003C/code\u003E\uff0c\u4f7f\u7528 \u003Ccode\u003E{0}\u003C/code\u003E \u66ff\u4ee3\u539f\u6765\u7684\u5217\u540d\u3002\u003C/p\u003E\n\n\u003Cp\u003EMySql \u5bf9\u5e94\u7684\u914d\u7f6e\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003EwrapKeyword=`{0}`\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u4f7f\u7528\u8be5\u914d\u7f6e\u540e\uff0c\u7c7b\u4f3c \u003Ccode\u003Eprivate String order\u003C/code\u003E \u5c31\u4e0d\u9700\u8981\u901a\u8fc7 \u003Ccode\u003E@Column\u003C/code\u003E \u6765\u6307\u5b9a\u522b\u540d\u3002\u003C/p\u003E\n\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"3-14-checkexampleentityclass_1\" href=\"#3-14-checkexampleentityclass_1\"\u003E\u003C/a\u003E3.14  checkExampleEntityClass\u003C/h3\u003E\n\u003Cp\u003E\u9ed8\u8ba4 \u003Ccode\u003Efalse\u003C/code\u003E \u7528\u4e8e\u6821\u9a8c\u901a\u7528 \u003Ccode\u003EExample\u003C/code\u003E \u6784\u9020\u53c2\u6570 \u003Ccode\u003EentityClass\u003C/code\u003E \u662f\u5426\u548c\u5f53\u524d\u8c03\u7528\u7684 \u003Ccode\u003EMapper\u0026lt;EntityClass\u0026gt;\u003C/code\u003E \u7c7b\u578b\u4e00\u81f4\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u5047\u8bbe\u5b58\u5728\u4e0b\u9762\u4ee3\u7801\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"n\"\u003EExample\u003C/span\u003E \u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"k\"\u003Enew\u003C/span\u003E \u003Cspan class=\"n\"\u003EExample\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003ECity\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eclass\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Exxx\u003C/span\u003E\u003Cspan class=\"o\"\u003E...;\u003C/span\u003E\u003Cspan class=\"c1\"\u003E//\u8bbe\u7f6e\u6761\u4ef6\u7684\u65b9\u6cd5\u003C/span\u003E\n\u003Cspan class=\"n\"\u003EcountryMapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EselectByExample\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u6ce8\u610f\uff0c\u8fd9\u91cc\u4f7f\u7528 \u003Ccode\u003ECity\u003C/code\u003E \u521b\u5efa\u7684 \u003Ccode\u003EExample\u003C/code\u003E\uff0c\u672c\u8be5\u4f7f\u7528 \u003Ccode\u003EcityMapper\u003C/code\u003E \u6765\u8c03\u7528\uff0c\u4f46\u662f\u8fd9\u91cc\u4f7f\u7528\u4e86 \u003Ccode\u003EcountryMapper\u003C/code\u003E\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4f1a\u51fa\u73b0\u5b57\u6bb5\u4e0d\u5339\u914d\u7684\u9519\u8bef\uff0c\u003Cstrong\u003E\u66f4\u7279\u6b8a\u7684\u60c5\u51b5\u4e0b\u4f1a\u6b63\u597d\u5339\u914d\u5b57\u6bb5\uff0c\u4f46\u662f\u5374\u64cd\u4f5c\u9519\u4e86\u8868\uff01\u003C/strong\u003E\u003C/p\u003E\n\n\u003Cp\u003E\u914d\u7f6e\u8be5\u5b57\u6bb5\u4e3a \u003Ccode\u003Etrue\u003C/code\u003E \u540e\u5c31\u4f1a\u5bf9\u4e0d\u5339\u914d\u7684\u60c5\u51b5\u8fdb\u884c\u6821\u9a8c\uff01\u003C/p\u003E\n\n\u003Cp\u003E\u914d\u7f6e\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003EcheckExampleEntityClass=true\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"3-15-safedelete_1\" href=\"#3-15-safedelete_1\"\u003E\u003C/a\u003E3.15 safeDelete\u003C/h3\u003E\n\u003Cp\u003E\u914d\u7f6e\u4e3a true \u540e\uff0cdelete \u548c deleteByExample \u90fd\u5fc5\u987b\u8bbe\u7f6e\u67e5\u8be2\u6761\u4ef6\u624d\u80fd\u5220\u9664\uff0c\u5426\u5219\u4f1a\u629b\u51fa\u5f02\u5e38\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u914d\u7f6e\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003EsafeDelete=true\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u4f7f\u7528\u6548\u679c\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003ECaused by: tk.mybatis.mapper.MapperException: \u0026lt;[\u901a\u7528 Mapper \u914d\u7f6e safeDelete=true]\u0026gt; delete \u65b9\u6cd5\u6ca1\u6709\u6307\u5b9a\u67e5\u8be2\u6761\u4ef6\uff0c\u4e0d\u5141\u8bb8\u6267\u884c\u8be5\u64cd\u4f5c!\n    at tk.mybatis.mapper.util.OGNL.notAllNullParameterCheck(OGNL.java:91)\n    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n    at java.lang.reflect.Method.invoke(Method.java:497)\n    at org.apache.ibatis.ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:899)\n    at org.apache.ibatis.ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1544)\n    ... 53 more\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"3-16-usejavatype_1\" href=\"#3-16-usejavatype_1\"\u003E\u003C/a\u003E3.16 useJavaType\u003C/h3\u003E\n\u003Cp\u003E\u8bbe\u7f6e true \u65f6\uff0c\u53c2\u6570\u4e2d\u4f1a\u589e\u52a0 javaType \u8bbe\u7f6e\uff0c\u5982 \u003Ccode\u003E{id, javaType=java.lang.Long}\u003C/code\u003E\u3002\u5728 \u003Ccode\u003E\u0026lt;resultMap\u0026gt;\u003C/code\u003E \u4e2d\u4e5f\u4f1a\u8bbe\u7f6e \u003Ccode\u003EjavaType\u003C/code\u003E \u5c5e\u6027\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u914d\u7f6e\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003EuseJavaType=true\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u5bf9\u4e8e\u4f7f\u7528 \u003Ccode\u003EUser extends Pk\u0026lt;Long\u0026gt;\u003C/code\u003E \u5f62\u5f0f\u65f6\uff0c\u9700\u8981\u8bbe\u7f6e\uff0c\u5426\u5219 mybatis \u4f4e\u7248\u672c(\u0026lt;3.4.0) \u65e0\u6cd5\u8bc6\u522b\u7c7b\u578b\u3002\u003C/p\u003E\n\n\u003Cblockquote\u003E\n\u003Cp\u003E\u5efa\u8bae\u5347\u7ea7\u5230 mybatis 3.4.x \u7684\u6700\u65b0\u7248\u672c\u003C/p\u003E\n\u003C/blockquote\u003E\n\n\u003Cp\u003E\u4f8b\u5982\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"kd\"\u003Eclass\u003C/span\u003E \u003Cspan class=\"nc\"\u003EPk\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003ET\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n  \u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"n\"\u003ET\u003C/span\u003E \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n\n  \u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"n\"\u003ET\u003C/span\u003E \u003Cspan class=\"nf\"\u003EgetId\u003C/span\u003E\u003Cspan class=\"o\"\u003E()\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n    \u003Cspan class=\"k\"\u003Ereturn\u003C/span\u003E \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n  \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\n  \u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kt\"\u003Evoid\u003C/span\u003E \u003Cspan class=\"nf\"\u003EsetId\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003ET\u003C/span\u003E \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n    \u003Cspan class=\"k\"\u003Ethis\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eid\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n  \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\n\u003Cspan class=\"kd\"\u003Eclass\u003C/span\u003E \u003Cspan class=\"nc\"\u003EUser\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eextends\u003C/span\u003E \u003Cspan class=\"n\"\u003EPk\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003ELong\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n  \u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"n\"\u003EString\u003C/span\u003E \u003Cspan class=\"n\"\u003Ename\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n\u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u5982\u679c\u4e0d\u8bbe\u7f6e javaType\uff0c\u4f4e\u7248\u672c\u7684 MyBatis \u4f1a\u8ba4\u4e3a id \u7684\u7c7b\u578b\u4e3a Object\u3002\u5347\u7ea7 MyBatis \u5230 3.4.0+ \u6700\u597d\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u8bbe\u7f6e \u003Ccode\u003EuseJavaType\u003C/code\u003E \u53ea\u5bf9\u901a\u7528 Mapper \u81ea\u5df1\u65b9\u6cd5\u6709\u6548\uff0c\u81ea\u5df1\u5199\u7684\u5176\u4ed6\u65b9\u6cd5\u8fd8\u9700\u8981\u81ea\u5df1\u6307\u5b9a\u3002\u003C/p\u003E\n\n\u003Cblockquote\u003E\n\u003Cp\u003E\u003Cstrong\u003E\u7279\u522b\u6ce8\u610f\u003C/strong\u003E\u003C/p\u003E\n\n\u003Cp\u003E\u4f7f\u7528 useJavaType=true \u540e\uff0c\u8c03\u7528 \u003Ccode\u003EByPrimaryKey\u003C/code\u003E \u7c7b\u7684\u65b9\u6cd5\u65f6\uff0c\u9700\u8981\u6309\u7167\u5b9e\u4f53\u4e2d\u5bf9\u5e94\u7684\u7c7b\u578b\u6765\u6307\u5b9a\uff0c\u4f8b\u5982\u4e3b\u952e\u7c7b\u578b\u4e3a \u003Ccode\u003ELong\u003C/code\u003E \u65f6\uff0c\u5fc5\u987b \u003Ccode\u003Emapper.selectByPrimaryKey(1L)\u003C/code\u003E\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u4e0d\u914d\u7f6e\u65f6\uff0c\u6ca1\u6709\u8fd9\u4e2a\u9650\u5236\uff0c\u53ef\u4ee5\u4f7f\u7528  \u003Ccode\u003Emapper.selectByPrimaryKey(1)\u003C/code\u003E \u6216  \u003Ccode\u003Emapper.selectByPrimaryKey(\u0026quot;1\u0026quot;)\u003C/code\u003E \u7b49\u7c7b\u578b\u3002\u003C/p\u003E\n\u003C/blockquote\u003E\n","208209":"\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"\u56db-\u4ee3\u7801\u751f\u6210\u5668_1\" href=\"#\u56db-\u4ee3\u7801\u751f\u6210\u5668_1\"\u003E\u003C/a\u003E\u56db\u3001\u4ee3\u7801\u751f\u6210\u5668\u003C/h2\u003E","208211":"\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"\u4e94-\u6269\u5c55\u901a\u7528\u63a5\u53e3_1\" href=\"#\u4e94-\u6269\u5c55\u901a\u7528\u63a5\u53e3_1\"\u003E\u003C/a\u003E\u4e94\u3001\u6269\u5c55\u901a\u7528\u63a5\u53e3\u003C/h2\u003E","208213":"\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"\u516d-example-\u7528\u6cd5_1\" href=\"#\u516d-example-\u7528\u6cd5_1\"\u003E\u003C/a\u003E\u516d\u3001Example \u7528\u6cd5\u003C/h2\u003E\n\u003Cp\u003E\u901a\u7528 Mapper \u4e2d\u7684 Example \u65b9\u6cd5\u6709\u4e24\u5927\u7c7b\u5b9a\u4e49\uff0c\u4e00\u4e2a\u53c2\u6570\u548c\u4e24\u4e2a\u53c2\u6570\u7684\uff0c\u4f8b\u5982\u4e0b\u9762\u4e24\u4e2a\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"n\"\u003EList\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003ET\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"nf\"\u003EselectByExample\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EObject\u003C/span\u003E \u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\n\u003Cspan class=\"kt\"\u003Eint\u003C/span\u003E \u003Cspan class=\"nf\"\u003EupdateByExampleSelective\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"nd\"\u003E@Param\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"record\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E \u003Cspan class=\"n\"\u003ET\u003C/span\u003E \u003Cspan class=\"n\"\u003Erecord\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E \u003Cspan class=\"nd\"\u003E@Param\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"example\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E \u003Cspan class=\"n\"\u003EObject\u003C/span\u003E \u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u6240\u6709 Example \u65b9\u6cd5\u4e2d\u7684 example \u7c7b\u578b\u90fd\u662f \u003Ccode\u003EObject\u003C/code\u003E \u7c7b\u578b\uff0c\u8fd9\u662f\u56e0\u4e3a\u901a\u7528 Mapper \u652f\u6301\u6240\u6709\u7b26\u5408 Example \u7ed3\u6784\u7684\u53c2\u6570\uff0c\u4f8b\u5982\u901a\u8fc7 MBG \u751f\u6210\u7684 CountryExample\u3001UserExample \u7c7b\u3002\u8fd8\u6709\u901a\u7528 Mapper \u4e2d\u63d0\u4f9b\u7684\u901a\u7528 Example\uff0c\u4ee5\u53ca\u652f\u6301 Java8 \u65b9\u6cd5\u5f15\u7528\u7684 Weekend \u7c7b\u578b\u3002\u003C/p\u003E\n\n\u003Cblockquote\u003E\n\u003Cp\u003E\u914d\u7f6e\u4e2d\u6709\u4e00\u4e2a\u548c Example \u6709\u5173\u7684\u53c2\u6570\uff0c\u70b9\u51fb\u67e5\u770b \u003Ca href=\"3.config#314--checkexampleentityclass\" class=\"md_relative_url\"\u003E3.14  checkExampleEntityClass\u003C/a\u003E\u3002\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"6-1-mbg-\u751f\u6210\u7684-example_1\" href=\"#6-1-mbg-\u751f\u6210\u7684-example_1\"\u003E\u003C/a\u003E6.1 MBG \u751f\u6210\u7684 Example\u003C/h3\u003E\n\u003Cp\u003E\u7528\u6cd5\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"n\"\u003ECountryExample\u003C/span\u003E \u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"k\"\u003Enew\u003C/span\u003E \u003Cspan class=\"n\"\u003ECountryExample\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n\u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EcreateCriteria\u003C/span\u003E\u003Cspan class=\"o\"\u003E().\u003C/span\u003E\u003Cspan class=\"na\"\u003EandCountrynameLike\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"A%\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eor\u003C/span\u003E\u003Cspan class=\"o\"\u003E().\u003C/span\u003E\u003Cspan class=\"na\"\u003EandIdGreaterThan\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"mi\"\u003E100\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EsetDistinct\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"kc\"\u003Etrue\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"kt\"\u003Eint\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecount\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003Emapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EdeleteByExample\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u5bf9\u4e8e\u7684 SQL \u65e5\u5fd7\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"n\"\u003EDEBUG\u003C/span\u003E \u003Cspan class=\"p\"\u003E[\u003C/span\u003E\u003Cspan class=\"n\"\u003Emain\u003C/span\u003E\u003Cspan class=\"p\"\u003E]\u003C/span\u003E \u003Cspan class=\"o\"\u003E-\u003C/span\u003E \u003Cspan class=\"o\"\u003E==\u0026gt;\u003C/span\u003E  \u003Cspan class=\"n\"\u003EPreparing\u003C/span\u003E\u003Cspan class=\"p\"\u003E:\u003C/span\u003E \u003Cspan class=\"k\"\u003EDELETE\u003C/span\u003E \u003Cspan class=\"k\"\u003EFROM\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountry\u003C/span\u003E \u003Cspan class=\"k\"\u003EWHERE\u003C/span\u003E \u003Cspan class=\"p\"\u003E(\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountryname\u003C/span\u003E \u003Cspan class=\"k\"\u003Elike\u003C/span\u003E \u003Cspan class=\"o\"\u003E?\u003C/span\u003E \u003Cspan class=\"p\"\u003E)\u003C/span\u003E \u003Cspan class=\"k\"\u003Eor\u003C/span\u003E \u003Cspan class=\"p\"\u003E(\u003C/span\u003E \u003Cspan class=\"n\"\u003EId\u003C/span\u003E \u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"o\"\u003E?\u003C/span\u003E \u003Cspan class=\"p\"\u003E)\u003C/span\u003E \n\u003Cspan class=\"n\"\u003EDEBUG\u003C/span\u003E \u003Cspan class=\"p\"\u003E[\u003C/span\u003E\u003Cspan class=\"n\"\u003Emain\u003C/span\u003E\u003Cspan class=\"p\"\u003E]\u003C/span\u003E \u003Cspan class=\"o\"\u003E-\u003C/span\u003E \u003Cspan class=\"o\"\u003E==\u0026gt;\u003C/span\u003E \u003Cspan class=\"k\"\u003EParameters\u003C/span\u003E\u003Cspan class=\"p\"\u003E:\u003C/span\u003E \u003Cspan class=\"n\"\u003EA\u003C/span\u003E\u003Cspan class=\"o\"\u003E%\u003C/span\u003E\u003Cspan class=\"p\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EString\u003C/span\u003E\u003Cspan class=\"p\"\u003E),\u003C/span\u003E \u003Cspan class=\"mi\"\u003E100\u003C/span\u003E\u003Cspan class=\"p\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EInteger\u003C/span\u003E\u003Cspan class=\"p\"\u003E)\u003C/span\u003E\n\u003Cspan class=\"n\"\u003EDEBUG\u003C/span\u003E \u003Cspan class=\"p\"\u003E[\u003C/span\u003E\u003Cspan class=\"n\"\u003Emain\u003C/span\u003E\u003Cspan class=\"p\"\u003E]\u003C/span\u003E \u003Cspan class=\"o\"\u003E-\u003C/span\u003E \u003Cspan class=\"o\"\u003E\u0026lt;==\u003C/span\u003E    \u003Cspan class=\"n\"\u003EUpdates\u003C/span\u003E\u003Cspan class=\"p\"\u003E:\u003C/span\u003E \u003Cspan class=\"mi\"\u003E95\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u751f\u6210\u7684 CountryExample \u4e2d\u5305\u542b\u4e86\u548c\u5b57\u6bb5\u76f8\u5173\u7684\u591a\u79cd\u65b9\u6cd5\uff0c\u6839\u636e\u81ea\u5df1\u7684\u9700\u8981\u8bbe\u7f6e\u76f8\u5e94\u7684\u6761\u4ef6\u5373\u53ef\u3002\u003C/p\u003E\n\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"6-2-\u901a\u7528-example_1\" href=\"#6-2-\u901a\u7528-example_1\"\u003E\u003C/a\u003E6.2 \u901a\u7528 Example\u003C/h3\u003E\n\u003Cp\u003E\u8fd9\u662f\u7531\u901a\u7528 Mapper \u63d0\u4f9b\u7684\u4e00\u4e2a\u7c7b\uff0c\u8fd9\u4e2a\u7c7b\u548c MBG \u751f\u6210\u7684\u76f8\u6bd4\uff0c\u9700\u8981\u81ea\u5df1\u8bbe\u7f6e\u5c5e\u6027\u540d\u3002\u8fd9\u4e2a\u7c7b\u8fd8\u989d\u5916\u63d0\u4f9b\u4e86\u66f4\u591a\u7684\u65b9\u6cd5\u3002\u003C/p\u003E\n\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"6-2-1-\u67e5\u8be2_1\" href=\"#6-2-1-\u67e5\u8be2_1\"\u003E\u003C/a\u003E6.2.1 \u67e5\u8be2\u003C/h4\u003E\n\u003Cp\u003E\u793a\u4f8b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"n\"\u003EExample\u003C/span\u003E \u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"k\"\u003Enew\u003C/span\u003E \u003Cspan class=\"n\"\u003EExample\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eclass\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EsetForUpdate\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"kc\"\u003Etrue\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EcreateCriteria\u003C/span\u003E\u003Cspan class=\"o\"\u003E().\u003C/span\u003E\u003Cspan class=\"na\"\u003EandGreaterThan\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"id\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E \u003Cspan class=\"mi\"\u003E100\u003C/span\u003E\u003Cspan class=\"o\"\u003E).\u003C/span\u003E\u003Cspan class=\"na\"\u003EandLessThan\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"id\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E\u003Cspan class=\"mi\"\u003E151\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eor\u003C/span\u003E\u003Cspan class=\"o\"\u003E().\u003C/span\u003E\u003Cspan class=\"na\"\u003EandLessThan\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"id\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E \u003Cspan class=\"mi\"\u003E41\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"n\"\u003EList\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountries\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003Emapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EselectByExample\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u65e5\u5fd7\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"n\"\u003EDEBUG\u003C/span\u003E \u003Cspan class=\"p\"\u003E[\u003C/span\u003E\u003Cspan class=\"n\"\u003Emain\u003C/span\u003E\u003Cspan class=\"p\"\u003E]\u003C/span\u003E \u003Cspan class=\"o\"\u003E-\u003C/span\u003E \u003Cspan class=\"o\"\u003E==\u0026gt;\u003C/span\u003E  \u003Cspan class=\"n\"\u003EPreparing\u003C/span\u003E\u003Cspan class=\"p\"\u003E:\u003C/span\u003E \u003Cspan class=\"k\"\u003ESELECT\u003C/span\u003E \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E\u003Cspan class=\"n\"\u003Ecountryname\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E\u003Cspan class=\"n\"\u003Ecountrycode\u003C/span\u003E \u003Cspan class=\"k\"\u003EFROM\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountry\u003C/span\u003E \u003Cspan class=\"k\"\u003EWHERE\u003C/span\u003E \u003Cspan class=\"p\"\u003E(\u003C/span\u003E \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E \u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"o\"\u003E?\u003C/span\u003E \u003Cspan class=\"k\"\u003Eand\u003C/span\u003E \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E \u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E \u003Cspan class=\"o\"\u003E?\u003C/span\u003E \u003Cspan class=\"p\"\u003E)\u003C/span\u003E \u003Cspan class=\"k\"\u003Eor\u003C/span\u003E \u003Cspan class=\"p\"\u003E(\u003C/span\u003E \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E \u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E \u003Cspan class=\"o\"\u003E?\u003C/span\u003E \u003Cspan class=\"p\"\u003E)\u003C/span\u003E \u003Cspan class=\"k\"\u003EORDER\u003C/span\u003E \u003Cspan class=\"k\"\u003EBY\u003C/span\u003E \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E \u003Cspan class=\"k\"\u003Edesc\u003C/span\u003E \u003Cspan class=\"k\"\u003EFOR\u003C/span\u003E \u003Cspan class=\"k\"\u003EUPDATE\u003C/span\u003E \n\u003Cspan class=\"n\"\u003EDEBUG\u003C/span\u003E \u003Cspan class=\"p\"\u003E[\u003C/span\u003E\u003Cspan class=\"n\"\u003Emain\u003C/span\u003E\u003Cspan class=\"p\"\u003E]\u003C/span\u003E \u003Cspan class=\"o\"\u003E-\u003C/span\u003E \u003Cspan class=\"o\"\u003E==\u0026gt;\u003C/span\u003E \u003Cspan class=\"k\"\u003EParameters\u003C/span\u003E\u003Cspan class=\"p\"\u003E:\u003C/span\u003E \u003Cspan class=\"mi\"\u003E100\u003C/span\u003E\u003Cspan class=\"p\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EInteger\u003C/span\u003E\u003Cspan class=\"p\"\u003E),\u003C/span\u003E \u003Cspan class=\"mi\"\u003E151\u003C/span\u003E\u003Cspan class=\"p\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EInteger\u003C/span\u003E\u003Cspan class=\"p\"\u003E),\u003C/span\u003E \u003Cspan class=\"mi\"\u003E41\u003C/span\u003E\u003Cspan class=\"p\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EInteger\u003C/span\u003E\u003Cspan class=\"p\"\u003E)\u003C/span\u003E\n\u003Cspan class=\"n\"\u003EDEBUG\u003C/span\u003E \u003Cspan class=\"p\"\u003E[\u003C/span\u003E\u003Cspan class=\"n\"\u003Emain\u003C/span\u003E\u003Cspan class=\"p\"\u003E]\u003C/span\u003E \u003Cspan class=\"o\"\u003E-\u003C/span\u003E \u003Cspan class=\"o\"\u003E\u0026lt;==\u003C/span\u003E      \u003Cspan class=\"n\"\u003ETotal\u003C/span\u003E\u003Cspan class=\"p\"\u003E:\u003C/span\u003E \u003Cspan class=\"mi\"\u003E90\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"6-2-2-\u52a8\u6001-sql_1\" href=\"#6-2-2-\u52a8\u6001-sql_1\"\u003E\u003C/a\u003E6.2.2 \u52a8\u6001 SQL\u003C/h4\u003E\n\u003Cp\u003E\u793a\u4f8b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"n\"\u003EExample\u003C/span\u003E \u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"k\"\u003Enew\u003C/span\u003E \u003Cspan class=\"n\"\u003EExample\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eclass\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"n\"\u003EExample\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003ECriteria\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecriteria\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EcreateCriteria\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n\u003Cspan class=\"k\"\u003Eif\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Equery\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EgetCountryname\u003C/span\u003E\u003Cspan class=\"o\"\u003E()\u003C/span\u003E \u003Cspan class=\"o\"\u003E!=\u003C/span\u003E \u003Cspan class=\"kc\"\u003Enull\u003C/span\u003E\u003Cspan class=\"o\"\u003E){\u003C/span\u003E\n    \u003Cspan class=\"n\"\u003Ecriteria\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EandLike\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"countryname\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E \u003Cspan class=\"n\"\u003Equery\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EgetCountryname\u003C/span\u003E\u003Cspan class=\"o\"\u003E()\u003C/span\u003E \u003Cspan class=\"o\"\u003E+\u003C/span\u003E \u003Cspan class=\"s\"\u003E\"%\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003Cspan class=\"k\"\u003Eif\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Equery\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EgetId\u003C/span\u003E\u003Cspan class=\"o\"\u003E()\u003C/span\u003E \u003Cspan class=\"o\"\u003E!=\u003C/span\u003E \u003Cspan class=\"kc\"\u003Enull\u003C/span\u003E\u003Cspan class=\"o\"\u003E){\u003C/span\u003E\n    \u003Cspan class=\"n\"\u003Ecriteria\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EandGreaterThan\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"id\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E \u003Cspan class=\"n\"\u003Equery\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EgetId\u003C/span\u003E\u003Cspan class=\"o\"\u003E());\u003C/span\u003E\n\u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003Cspan class=\"n\"\u003EList\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountries\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003Emapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EselectByExample\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u65e5\u5fd7\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"n\"\u003EDEBUG\u003C/span\u003E \u003Cspan class=\"p\"\u003E[\u003C/span\u003E\u003Cspan class=\"n\"\u003Emain\u003C/span\u003E\u003Cspan class=\"p\"\u003E]\u003C/span\u003E \u003Cspan class=\"o\"\u003E-\u003C/span\u003E \u003Cspan class=\"o\"\u003E==\u0026gt;\u003C/span\u003E  \u003Cspan class=\"n\"\u003EPreparing\u003C/span\u003E\u003Cspan class=\"p\"\u003E:\u003C/span\u003E \u003Cspan class=\"k\"\u003ESELECT\u003C/span\u003E \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E\u003Cspan class=\"n\"\u003Ecountryname\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E\u003Cspan class=\"n\"\u003Ecountrycode\u003C/span\u003E \u003Cspan class=\"k\"\u003EFROM\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountry\u003C/span\u003E \u003Cspan class=\"k\"\u003EWHERE\u003C/span\u003E \u003Cspan class=\"p\"\u003E(\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountryname\u003C/span\u003E \u003Cspan class=\"k\"\u003Elike\u003C/span\u003E \u003Cspan class=\"o\"\u003E?\u003C/span\u003E \u003Cspan class=\"p\"\u003E)\u003C/span\u003E \u003Cspan class=\"k\"\u003EORDER\u003C/span\u003E \u003Cspan class=\"k\"\u003EBY\u003C/span\u003E \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E \u003Cspan class=\"k\"\u003Edesc\u003C/span\u003E \n\u003Cspan class=\"n\"\u003EDEBUG\u003C/span\u003E \u003Cspan class=\"p\"\u003E[\u003C/span\u003E\u003Cspan class=\"n\"\u003Emain\u003C/span\u003E\u003Cspan class=\"p\"\u003E]\u003C/span\u003E \u003Cspan class=\"o\"\u003E-\u003C/span\u003E \u003Cspan class=\"o\"\u003E==\u0026gt;\u003C/span\u003E \u003Cspan class=\"k\"\u003EParameters\u003C/span\u003E\u003Cspan class=\"p\"\u003E:\u003C/span\u003E \u003Cspan class=\"n\"\u003EChina\u003C/span\u003E\u003Cspan class=\"o\"\u003E%\u003C/span\u003E\u003Cspan class=\"p\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EString\u003C/span\u003E\u003Cspan class=\"p\"\u003E)\u003C/span\u003E\n\u003Cspan class=\"n\"\u003EDEBUG\u003C/span\u003E \u003Cspan class=\"p\"\u003E[\u003C/span\u003E\u003Cspan class=\"n\"\u003Emain\u003C/span\u003E\u003Cspan class=\"p\"\u003E]\u003C/span\u003E \u003Cspan class=\"o\"\u003E-\u003C/span\u003E \u003Cspan class=\"o\"\u003E\u0026lt;==\u003C/span\u003E      \u003Cspan class=\"n\"\u003ETotal\u003C/span\u003E\u003Cspan class=\"p\"\u003E:\u003C/span\u003E \u003Cspan class=\"mi\"\u003E1\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"6-2-3-\u6392\u5e8f_1\" href=\"#6-2-3-\u6392\u5e8f_1\"\u003E\u003C/a\u003E6.2.3 \u6392\u5e8f\u003C/h4\u003E\n\u003Cp\u003E\u793a\u4f8b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"n\"\u003EExample\u003C/span\u003E \u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"k\"\u003Enew\u003C/span\u003E \u003Cspan class=\"n\"\u003EExample\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eclass\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EorderBy\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"id\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E).\u003C/span\u003E\u003Cspan class=\"na\"\u003Edesc\u003C/span\u003E\u003Cspan class=\"o\"\u003E().\u003C/span\u003E\u003Cspan class=\"na\"\u003EorderBy\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"countryname\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E).\u003C/span\u003E\u003Cspan class=\"na\"\u003EorderBy\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"countrycode\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E).\u003C/span\u003E\u003Cspan class=\"na\"\u003Easc\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n\u003Cspan class=\"n\"\u003EList\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountries\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003Emapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EselectByExample\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u65e5\u5fd7\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"n\"\u003EDEBUG\u003C/span\u003E \u003Cspan class=\"p\"\u003E[\u003C/span\u003E\u003Cspan class=\"n\"\u003Emain\u003C/span\u003E\u003Cspan class=\"p\"\u003E]\u003C/span\u003E \u003Cspan class=\"o\"\u003E-\u003C/span\u003E \u003Cspan class=\"o\"\u003E==\u0026gt;\u003C/span\u003E  \u003Cspan class=\"n\"\u003EPreparing\u003C/span\u003E\u003Cspan class=\"p\"\u003E:\u003C/span\u003E \u003Cspan class=\"k\"\u003ESELECT\u003C/span\u003E \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E\u003Cspan class=\"n\"\u003Ecountryname\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E\u003Cspan class=\"n\"\u003Ecountrycode\u003C/span\u003E \u003Cspan class=\"k\"\u003EFROM\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountry\u003C/span\u003E \u003Cspan class=\"k\"\u003Eorder\u003C/span\u003E \u003Cspan class=\"k\"\u003Eby\u003C/span\u003E \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E \u003Cspan class=\"k\"\u003EDESC\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E\u003Cspan class=\"n\"\u003Ecountryname\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E\u003Cspan class=\"n\"\u003Ecountrycode\u003C/span\u003E \u003Cspan class=\"k\"\u003EASC\u003C/span\u003E \n\u003Cspan class=\"n\"\u003EDEBUG\u003C/span\u003E \u003Cspan class=\"p\"\u003E[\u003C/span\u003E\u003Cspan class=\"n\"\u003Emain\u003C/span\u003E\u003Cspan class=\"p\"\u003E]\u003C/span\u003E \u003Cspan class=\"o\"\u003E-\u003C/span\u003E \u003Cspan class=\"o\"\u003E==\u0026gt;\u003C/span\u003E \u003Cspan class=\"k\"\u003EParameters\u003C/span\u003E\u003Cspan class=\"p\"\u003E:\u003C/span\u003E \n\u003Cspan class=\"n\"\u003EDEBUG\u003C/span\u003E \u003Cspan class=\"p\"\u003E[\u003C/span\u003E\u003Cspan class=\"n\"\u003Emain\u003C/span\u003E\u003Cspan class=\"p\"\u003E]\u003C/span\u003E \u003Cspan class=\"o\"\u003E-\u003C/span\u003E \u003Cspan class=\"o\"\u003E\u0026lt;==\u003C/span\u003E      \u003Cspan class=\"n\"\u003ETotal\u003C/span\u003E\u003Cspan class=\"p\"\u003E:\u003C/span\u003E \u003Cspan class=\"mi\"\u003E183\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"6-2-4-\u53bb\u91cd_1\" href=\"#6-2-4-\u53bb\u91cd_1\"\u003E\u003C/a\u003E6.2.4 \u53bb\u91cd\u003C/h4\u003E\n\u003Cp\u003E\u793a\u4f8b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"n\"\u003ECountryExample\u003C/span\u003E \u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"k\"\u003Enew\u003C/span\u003E \u003Cspan class=\"n\"\u003ECountryExample\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n\u003Cspan class=\"c1\"\u003E//\u8bbe\u7f6e distinct\u003C/span\u003E\n\u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EsetDistinct\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"kc\"\u003Etrue\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EcreateCriteria\u003C/span\u003E\u003Cspan class=\"o\"\u003E().\u003C/span\u003E\u003Cspan class=\"na\"\u003EandCountrynameLike\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"A%\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eor\u003C/span\u003E\u003Cspan class=\"o\"\u003E().\u003C/span\u003E\u003Cspan class=\"na\"\u003EandIdGreaterThan\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"mi\"\u003E100\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"n\"\u003EList\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountries\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003Emapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EselectByExample\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u65e5\u5fd7\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"n\"\u003EDEBUG\u003C/span\u003E \u003Cspan class=\"p\"\u003E[\u003C/span\u003E\u003Cspan class=\"n\"\u003Emain\u003C/span\u003E\u003Cspan class=\"p\"\u003E]\u003C/span\u003E \u003Cspan class=\"o\"\u003E-\u003C/span\u003E \u003Cspan class=\"o\"\u003E==\u0026gt;\u003C/span\u003E  \u003Cspan class=\"n\"\u003EPreparing\u003C/span\u003E\u003Cspan class=\"p\"\u003E:\u003C/span\u003E \u003Cspan class=\"k\"\u003ESELECT\u003C/span\u003E \u003Cspan class=\"k\"\u003Edistinct\u003C/span\u003E \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E\u003Cspan class=\"n\"\u003Ecountryname\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E\u003Cspan class=\"n\"\u003Ecountrycode\u003C/span\u003E \u003Cspan class=\"k\"\u003EFROM\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountry\u003C/span\u003E \u003Cspan class=\"k\"\u003EWHERE\u003C/span\u003E \u003Cspan class=\"p\"\u003E(\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountryname\u003C/span\u003E \u003Cspan class=\"k\"\u003Elike\u003C/span\u003E \u003Cspan class=\"o\"\u003E?\u003C/span\u003E \u003Cspan class=\"p\"\u003E)\u003C/span\u003E \u003Cspan class=\"k\"\u003Eor\u003C/span\u003E \u003Cspan class=\"p\"\u003E(\u003C/span\u003E \u003Cspan class=\"n\"\u003EId\u003C/span\u003E \u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"o\"\u003E?\u003C/span\u003E \u003Cspan class=\"p\"\u003E)\u003C/span\u003E \u003Cspan class=\"k\"\u003EORDER\u003C/span\u003E \u003Cspan class=\"k\"\u003EBY\u003C/span\u003E \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E \u003Cspan class=\"k\"\u003Edesc\u003C/span\u003E \n\u003Cspan class=\"n\"\u003EDEBUG\u003C/span\u003E \u003Cspan class=\"p\"\u003E[\u003C/span\u003E\u003Cspan class=\"n\"\u003Emain\u003C/span\u003E\u003Cspan class=\"p\"\u003E]\u003C/span\u003E \u003Cspan class=\"o\"\u003E-\u003C/span\u003E \u003Cspan class=\"o\"\u003E==\u0026gt;\u003C/span\u003E \u003Cspan class=\"k\"\u003EParameters\u003C/span\u003E\u003Cspan class=\"p\"\u003E:\u003C/span\u003E \u003Cspan class=\"n\"\u003EA\u003C/span\u003E\u003Cspan class=\"o\"\u003E%\u003C/span\u003E\u003Cspan class=\"p\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EString\u003C/span\u003E\u003Cspan class=\"p\"\u003E),\u003C/span\u003E \u003Cspan class=\"mi\"\u003E100\u003C/span\u003E\u003Cspan class=\"p\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EInteger\u003C/span\u003E\u003Cspan class=\"p\"\u003E)\u003C/span\u003E\n\u003Cspan class=\"n\"\u003EDEBUG\u003C/span\u003E \u003Cspan class=\"p\"\u003E[\u003C/span\u003E\u003Cspan class=\"n\"\u003Emain\u003C/span\u003E\u003Cspan class=\"p\"\u003E]\u003C/span\u003E \u003Cspan class=\"o\"\u003E-\u003C/span\u003E \u003Cspan class=\"o\"\u003E\u0026lt;==\u003C/span\u003E      \u003Cspan class=\"n\"\u003ETotal\u003C/span\u003E\u003Cspan class=\"p\"\u003E:\u003C/span\u003E \u003Cspan class=\"mi\"\u003E95\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"6-2-5-\u8bbe\u7f6e\u67e5\u8be2\u5217_1\" href=\"#6-2-5-\u8bbe\u7f6e\u67e5\u8be2\u5217_1\"\u003E\u003C/a\u003E6.2.5 \u8bbe\u7f6e\u67e5\u8be2\u5217\u003C/h4\u003E\n\u003Cp\u003E\u793a\u4f8b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"n\"\u003EExample\u003C/span\u003E \u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"k\"\u003Enew\u003C/span\u003E \u003Cspan class=\"n\"\u003EExample\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eclass\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EselectProperties\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"id\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E \u003Cspan class=\"s\"\u003E\"countryname\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"n\"\u003EList\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountries\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003Emapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EselectByExample\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u65e5\u5fd7\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"n\"\u003EDEBUG\u003C/span\u003E \u003Cspan class=\"p\"\u003E[\u003C/span\u003E\u003Cspan class=\"n\"\u003Emain\u003C/span\u003E\u003Cspan class=\"p\"\u003E]\u003C/span\u003E \u003Cspan class=\"o\"\u003E-\u003C/span\u003E \u003Cspan class=\"o\"\u003E==\u0026gt;\u003C/span\u003E  \u003Cspan class=\"n\"\u003EPreparing\u003C/span\u003E\u003Cspan class=\"p\"\u003E:\u003C/span\u003E \u003Cspan class=\"k\"\u003ESELECT\u003C/span\u003E \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E \u003Cspan class=\"p\"\u003E,\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountryname\u003C/span\u003E \u003Cspan class=\"k\"\u003EFROM\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountry\u003C/span\u003E \u003Cspan class=\"k\"\u003EORDER\u003C/span\u003E \u003Cspan class=\"k\"\u003EBY\u003C/span\u003E \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E \u003Cspan class=\"k\"\u003Edesc\u003C/span\u003E \n\u003Cspan class=\"n\"\u003EDEBUG\u003C/span\u003E \u003Cspan class=\"p\"\u003E[\u003C/span\u003E\u003Cspan class=\"n\"\u003Emain\u003C/span\u003E\u003Cspan class=\"p\"\u003E]\u003C/span\u003E \u003Cspan class=\"o\"\u003E-\u003C/span\u003E \u003Cspan class=\"o\"\u003E==\u0026gt;\u003C/span\u003E \u003Cspan class=\"k\"\u003EParameters\u003C/span\u003E\u003Cspan class=\"p\"\u003E:\u003C/span\u003E \n\u003Cspan class=\"n\"\u003EDEBUG\u003C/span\u003E \u003Cspan class=\"p\"\u003E[\u003C/span\u003E\u003Cspan class=\"n\"\u003Emain\u003C/span\u003E\u003Cspan class=\"p\"\u003E]\u003C/span\u003E \u003Cspan class=\"o\"\u003E-\u003C/span\u003E \u003Cspan class=\"o\"\u003E\u0026lt;==\u003C/span\u003E      \u003Cspan class=\"n\"\u003ETotal\u003C/span\u003E\u003Cspan class=\"p\"\u003E:\u003C/span\u003E \u003Cspan class=\"mi\"\u003E183\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003E\u9664\u4e86\u8fd9\u91cc\u63d0\u5230\u7684\u65b9\u6cd5\u5916\uff0c\u8fd8\u6709\u5f88\u591a\u5176\u4ed6\u7684\u65b9\u6cd5\uff0c\u53ef\u4ee5\u67e5\u770b Example \u6e90\u7801\u8fdb\u884c\u4e86\u89e3\u3002\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"6-3-example-builder-\u65b9\u5f0f_1\" href=\"#6-3-example-builder-\u65b9\u5f0f_1\"\u003E\u003C/a\u003E6.3 Example.builder \u65b9\u5f0f\u003C/h3\u003E\n\u003Cp\u003E\u793a\u4f8b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"n\"\u003EExample\u003C/span\u003E \u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003EExample\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Ebuilder\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eclass\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n        \u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eselect\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"countryname\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n        \u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Ewhere\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003ESqls\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Ecustom\u003C/span\u003E\u003Cspan class=\"o\"\u003E().\u003C/span\u003E\u003Cspan class=\"na\"\u003EandGreaterThan\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"id\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E \u003Cspan class=\"mi\"\u003E100\u003C/span\u003E\u003Cspan class=\"o\"\u003E))\u003C/span\u003E\n        \u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EorderByAsc\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"countrycode\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n        \u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EforUpdate\u003C/span\u003E\u003Cspan class=\"o\"\u003E()\u003C/span\u003E\n        \u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Ebuild\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n\u003Cspan class=\"n\"\u003EList\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountries\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003Emapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EselectByExample\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u65e5\u5fd7\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"n\"\u003EDEBUG\u003C/span\u003E \u003Cspan class=\"p\"\u003E[\u003C/span\u003E\u003Cspan class=\"n\"\u003Emain\u003C/span\u003E\u003Cspan class=\"p\"\u003E]\u003C/span\u003E \u003Cspan class=\"o\"\u003E-\u003C/span\u003E \u003Cspan class=\"o\"\u003E==\u0026gt;\u003C/span\u003E  \u003Cspan class=\"n\"\u003EPreparing\u003C/span\u003E\u003Cspan class=\"p\"\u003E:\u003C/span\u003E \u003Cspan class=\"k\"\u003ESELECT\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountryname\u003C/span\u003E \u003Cspan class=\"k\"\u003EFROM\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountry\u003C/span\u003E \u003Cspan class=\"k\"\u003EWHERE\u003C/span\u003E \u003Cspan class=\"p\"\u003E(\u003C/span\u003E \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E \u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"o\"\u003E?\u003C/span\u003E \u003Cspan class=\"p\"\u003E)\u003C/span\u003E \u003Cspan class=\"k\"\u003Eorder\u003C/span\u003E \u003Cspan class=\"k\"\u003Eby\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountrycode\u003C/span\u003E \u003Cspan class=\"k\"\u003EAsc\u003C/span\u003E \u003Cspan class=\"k\"\u003EFOR\u003C/span\u003E \u003Cspan class=\"k\"\u003EUPDATE\u003C/span\u003E \n\u003Cspan class=\"n\"\u003EDEBUG\u003C/span\u003E \u003Cspan class=\"p\"\u003E[\u003C/span\u003E\u003Cspan class=\"n\"\u003Emain\u003C/span\u003E\u003Cspan class=\"p\"\u003E]\u003C/span\u003E \u003Cspan class=\"o\"\u003E-\u003C/span\u003E \u003Cspan class=\"o\"\u003E==\u0026gt;\u003C/span\u003E \u003Cspan class=\"k\"\u003EParameters\u003C/span\u003E\u003Cspan class=\"p\"\u003E:\u003C/span\u003E \u003Cspan class=\"mi\"\u003E100\u003C/span\u003E\u003Cspan class=\"p\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EInteger\u003C/span\u003E\u003Cspan class=\"p\"\u003E)\u003C/span\u003E\n\u003Cspan class=\"n\"\u003EDEBUG\u003C/span\u003E \u003Cspan class=\"p\"\u003E[\u003C/span\u003E\u003Cspan class=\"n\"\u003Emain\u003C/span\u003E\u003Cspan class=\"p\"\u003E]\u003C/span\u003E \u003Cspan class=\"o\"\u003E-\u003C/span\u003E \u003Cspan class=\"o\"\u003E\u0026lt;==\u003C/span\u003E      \u003Cspan class=\"n\"\u003ETotal\u003C/span\u003E\u003Cspan class=\"p\"\u003E:\u003C/span\u003E \u003Cspan class=\"mi\"\u003E83\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"6-4-weekend_1\" href=\"#6-4-weekend_1\"\u003E\u003C/a\u003E6.4 Weekend\u003C/h3\u003E\n\u003Cp\u003E\u4f7f\u7528 6.2 \u548c 6.3 \u4e2d\u7684 Example \u65f6\uff0c\u9700\u8981\u81ea\u5df1\u8f93\u5165\u5c5e\u6027\u540d\uff0c\u4f8b\u5982 \u003Ccode\u003E\u0026quot;countryname\u0026quot;\u003C/code\u003E\uff0c\u5047\u8bbe\u8f93\u5165\u9519\u8bef\uff0c\u6216\u8005\u6570\u636e\u5e93\u6709\u53d8\u5316\uff0c\u8fd9\u91cc\u5f88\u53ef\u80fd\u5c31\u4f1a\u51fa\u9519\uff0c\u56e0\u6b64\u57fa\u4e8e Java 8 \u7684\u65b9\u6cd5\u5f15\u7528\u662f\u4e00\u79cd\u66f4\u5b89\u5168\u7684\u7528\u6cd5\uff0c\u5982\u679c\u4f60\u4f7f\u7528 Java 8\uff0c\u4f60\u53ef\u4ee5\u8bd5\u8bd5 Weekend\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u793a\u4f8b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"n\"\u003EList\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"n\"\u003EselectByWeekendSql\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003Emapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EselectByExample\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"k\"\u003Enew\u003C/span\u003E \u003Cspan class=\"n\"\u003EExample\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EBuilder\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eclass\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n        \u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Ewhere\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EWeekendSqls\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E\u003Cspan class=\"n\"\u003Ecustom\u003C/span\u003E\u003Cspan class=\"o\"\u003E().\u003C/span\u003E\u003Cspan class=\"na\"\u003EandLike\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"nl\"\u003ECountry:\u003C/span\u003E\u003Cspan class=\"o\"\u003E:\u003C/span\u003E\u003Cspan class=\"n\"\u003EgetCountryname\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E \u003Cspan class=\"s\"\u003E\"%a%\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n                \u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EandGreaterThan\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"nl\"\u003ECountry:\u003C/span\u003E\u003Cspan class=\"o\"\u003E:\u003C/span\u003E\u003Cspan class=\"n\"\u003EgetCountrycode\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E \u003Cspan class=\"s\"\u003E\"123\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E))\u003C/span\u003E\n        \u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Ebuild\u003C/span\u003E\u003Cspan class=\"o\"\u003E());\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u65e5\u5fd7\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"n\"\u003EDEBUG\u003C/span\u003E \u003Cspan class=\"p\"\u003E[\u003C/span\u003E\u003Cspan class=\"n\"\u003Emain\u003C/span\u003E\u003Cspan class=\"p\"\u003E]\u003C/span\u003E \u003Cspan class=\"o\"\u003E-\u003C/span\u003E \u003Cspan class=\"o\"\u003E==\u0026gt;\u003C/span\u003E  \u003Cspan class=\"n\"\u003EPreparing\u003C/span\u003E\u003Cspan class=\"p\"\u003E:\u003C/span\u003E \u003Cspan class=\"k\"\u003ESELECT\u003C/span\u003E \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E\u003Cspan class=\"n\"\u003Ecountryname\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E\u003Cspan class=\"n\"\u003Ecountrycode\u003C/span\u003E \u003Cspan class=\"k\"\u003EFROM\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountry\u003C/span\u003E \u003Cspan class=\"k\"\u003EWHERE\u003C/span\u003E \u003Cspan class=\"p\"\u003E(\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountryname\u003C/span\u003E \u003Cspan class=\"k\"\u003Elike\u003C/span\u003E \u003Cspan class=\"o\"\u003E?\u003C/span\u003E \u003Cspan class=\"k\"\u003Eand\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountrycode\u003C/span\u003E \u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"o\"\u003E?\u003C/span\u003E \u003Cspan class=\"p\"\u003E)\u003C/span\u003E \n\u003Cspan class=\"n\"\u003EDEBUG\u003C/span\u003E \u003Cspan class=\"p\"\u003E[\u003C/span\u003E\u003Cspan class=\"n\"\u003Emain\u003C/span\u003E\u003Cspan class=\"p\"\u003E]\u003C/span\u003E \u003Cspan class=\"o\"\u003E-\u003C/span\u003E \u003Cspan class=\"o\"\u003E==\u0026gt;\u003C/span\u003E \u003Cspan class=\"k\"\u003EParameters\u003C/span\u003E\u003Cspan class=\"p\"\u003E:\u003C/span\u003E \u003Cspan class=\"o\"\u003E%\u003C/span\u003E\u003Cspan class=\"n\"\u003Ea\u003C/span\u003E\u003Cspan class=\"o\"\u003E%\u003C/span\u003E\u003Cspan class=\"p\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EString\u003C/span\u003E\u003Cspan class=\"p\"\u003E),\u003C/span\u003E \u003Cspan class=\"mi\"\u003E123\u003C/span\u003E\u003Cspan class=\"p\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EString\u003C/span\u003E\u003Cspan class=\"p\"\u003E)\u003C/span\u003E\n\u003Cspan class=\"n\"\u003EDEBUG\u003C/span\u003E \u003Cspan class=\"p\"\u003E[\u003C/span\u003E\u003Cspan class=\"n\"\u003Emain\u003C/span\u003E\u003Cspan class=\"p\"\u003E]\u003C/span\u003E \u003Cspan class=\"o\"\u003E-\u003C/span\u003E \u003Cspan class=\"o\"\u003E\u0026lt;==\u003C/span\u003E      \u003Cspan class=\"n\"\u003ETotal\u003C/span\u003E\u003Cspan class=\"p\"\u003E:\u003C/span\u003E \u003Cspan class=\"mi\"\u003E151\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u5728\u4ee3\u7801\u4e2d\u7684 \u003Ccode\u003ECountry::getCountryname\u003C/code\u003E \u5c31\u662f\u65b9\u6cd5\u5f15\u7528\uff0c\u901a\u8fc7\u8be5\u65b9\u6cd5\u53ef\u4ee5\u81ea\u52a8\u8f6c\u6362\u5bf9\u5e94\u7684\u5217\u540d\u3002\u003C/p\u003E\n","213170":"\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"7-1-\u4e8c\u7ea7\u7f13\u5b58_1\" href=\"#7-1-\u4e8c\u7ea7\u7f13\u5b58_1\"\u003E\u003C/a\u003E7.1 \u4e8c\u7ea7\u7f13\u5b58\u003C/h3\u003E\n\u003Cp\u003E\u5173\u4e8e\u4e8c\u7ea7\u7f13\u5b58\u7684\u4f8b\u5b50\uff0c\u53ef\u4ee5\u67e5\u770b\u6d4b\u8bd5\u4e2d\u7684 \u003Ccode\u003Etk.mybatis.mapper.cache.CacheTest\u003C/code\u003E\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u9996\u5148\u9700\u8981\u5f00\u542f\u4e8c\u7ea7\u7f13\u5b58\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"cp\"\u003E\u0026lt;!DOCTYPE configuration\n        PUBLIC \"-//mybatis.org//DTD Config 3.0//EN\"\n        \"http://mybatis.org/dtd/mybatis-3-config.dtd\"\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;configuration\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"nt\"\u003E\u0026lt;settings\u0026gt;\u003C/span\u003E\n        \u003Cspan class=\"nt\"\u003E\u0026lt;setting\u003C/span\u003E \u003Cspan class=\"na\"\u003Ename=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"cacheEnabled\"\u003C/span\u003E \u003Cspan class=\"na\"\u003Evalue=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"true\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E/\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"nt\"\u003E\u0026lt;/settings\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"c\"\u003E\u0026lt;!-- \u5176\u4ed6 --\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/configuration\u0026gt;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"7-1-1-\u53ea\u4f7f\u7528\u63a5\u53e3_1\" href=\"#7-1-1-\u53ea\u4f7f\u7528\u63a5\u53e3_1\"\u003E\u003C/a\u003E7.1.1 \u53ea\u4f7f\u7528\u63a5\u53e3\u003C/h4\u003E\n\u003Cp\u003E\u53ea\u7528\u63a5\u53e3\u65f6\uff0c\u53ea\u9700\u8981\u52a0\u4e00\u4e2a\u7f13\u5b58\u7684\u6ce8\u89e3\uff0c\u793a\u4f8b\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"cm\"\u003E/**\n * \u53ea\u6709\u63a5\u53e3\u65f6\uff0c\u52a0\u4e0b\u9762\u7684\u6ce8\u89e3\u5373\u53ef\n */\u003C/span\u003E\n\u003Cspan class=\"nd\"\u003E@CacheNamespace\u003C/span\u003E\n\u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kd\"\u003Einterface\u003C/span\u003E \u003Cspan class=\"nc\"\u003ECountryCacheMapper\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eextends\u003C/span\u003E \u003Cspan class=\"n\"\u003EMapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n\n\u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u5bf9\u7f13\u5b58\u7684\u8be6\u7ec6\u914d\u7f6e\u53ef\u4ee5\u901a\u8fc7\u8be5\u6ce8\u89e3\u63d0\u4f9b\u7684\u5c5e\u6027\u8fdb\u884c\u914d\u7f6e\u3002\u003C/p\u003E\n\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"7-1-2-\u63a5\u53e3\u548c-xml-\u6df7\u5408_1\" href=\"#7-1-2-\u63a5\u53e3\u548c-xml-\u6df7\u5408_1\"\u003E\u003C/a\u003E7.1.2 \u63a5\u53e3\u548c XML \u6df7\u5408\u003C/h4\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003E\u7531\u4e8e MyBatis \u76ee\u524d\u5904\u7406 XML \u548c \u63a5\u53e3\u4e2d\u7684\u5f15\u7528\u65f6\u5b58\u5728 BUG\uff0c\u6240\u4ee5\u53ea\u6709\u8fd9\u91cc\u63d0\u4f9b\u7684\u4e00\u79cd\u65b9\u5f0f\u8fdb\u884c\u914d\u7f6e\u3002\u4e5f\u5c31\u662f\u5728 XML \u4e2d\u914d\u7f6e \u003Ccode\u003E\u0026lt;cache/\u0026gt;\u003C/code\u003E\uff0c\u5728\u63a5\u53e3\u4e2d\u4f7f\u7528 \u003Ccode\u003E@CacheNamespaceRef(CountryCacheRefMapper.class)\u003C/code\u003E \u5f15\u7528\u6ce8\u89e3\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u5173\u4e8e\u8be5 BUG \u53ef\u4ee5\u67e5\u770b\u4e0b\u9762\u94fe\u63a5\uff1a\u003C/p\u003E\n\n\u003Cp\u003E\u003Ca target=\"_blank\" href=\"https://github.com/mybatis/mybatis-3/issues/1194\"\u003Ehttps://github.com/mybatis/mybatis-3/issues/1194\u003C/a\u003E\u003C/p\u003E\n\u003C/blockquote\u003E\n\n\u003Cp\u003E\u5728 XML \u4e2d\u5b9a\u4e49\u7f13\u5b58\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"cp\"\u003E\u0026lt;?xml version=\"1.0\" encoding=\"UTF-8\"?\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"cp\"\u003E\u0026lt;!DOCTYPE mapper\n        PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\"\n        \"http://mybatis.org/dtd/mybatis-3-mapper.dtd\"\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;mapper\u003C/span\u003E \u003Cspan class=\"na\"\u003Enamespace=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"tk.mybatis.mapper.cache.CountryCacheRefMapper\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"nt\"\u003E\u0026lt;cache/\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"nt\"\u003E\u0026lt;select\u003C/span\u003E \u003Cspan class=\"na\"\u003Eid=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"selectById\"\u003C/span\u003E \u003Cspan class=\"na\"\u003EresultType=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"tk.mybatis.mapper.base.Country\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E\u0026gt;\u003C/span\u003E\n        select * from country where id = #{id}\n    \u003Cspan class=\"nt\"\u003E\u0026lt;/select\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/mapper\u0026gt;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u5728\u63a5\u53e3\u4e2d\u914d\u7f6e\u6ce8\u89e3\u5f15\u7528\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nd\"\u003E@CacheNamespaceRef\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountryCacheRefMapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eclass\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n\u003Cspan class=\"c1\"\u003E//\u6216\u8005 @CacheNamespaceRef(name = \"tk.mybatis.mapper.cache.CountryCacheRefMapper\")\u003C/span\u003E\n\u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kd\"\u003Einterface\u003C/span\u003E \u003Cspan class=\"nc\"\u003ECountryCacheRefMapper\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eextends\u003C/span\u003E \u003Cspan class=\"n\"\u003EMapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n\n    \u003Cspan class=\"cm\"\u003E/**\n     * \u5b9a\u4e49\u5728 XML \u4e2d\u7684\u65b9\u6cd5\n     *\n     * @param id\n     * @return\n     */\u003C/span\u003E\n    \u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E \u003Cspan class=\"nf\"\u003EselectById\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EInteger\u003C/span\u003E \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Ccode\u003E@CacheNamespaceRef\u003C/code\u003E \u6307\u5b9a\u7684\u662f\u7f13\u5b58\u7684 \u003Ccode\u003Enamespace\u003C/code\u003E\uff0c\u5c31\u662f XML \u4e2d \u003Ccode\u003E\u0026lt;mapper\u0026gt;\u003C/code\u003E  \u4e2d\u7684 \u003Ccode\u003Enamespace\u003C/code\u003E \u5c5e\u6027\u3002\u003C/p\u003E\n\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"7-1-3-\u6f5c\u5728\u7684\u95ee\u9898_1\" href=\"#7-1-3-\u6f5c\u5728\u7684\u95ee\u9898_1\"\u003E\u003C/a\u003E7.1.3 \u6f5c\u5728\u7684\u95ee\u9898\u003C/h4\u003E\n\u003Cp\u003E\u901a\u7528 Mapper \u4e2d\u90e8\u5206 insert, update \u65b9\u6cd5\u4f7f\u7528\u4e86 \u003Ccode\u003E@Options\u003C/code\u003E \u6ce8\u89e3\uff0c\u5728 4.0 \u7248\u672c\u4e2d update \u65b9\u6cd5\u90fd\u53bb\u6389\u4e86\u8fd9\u4e2a\u6ce8\u89e3\uff0c\u4f46\u662f\u90e8\u5206 insert \u5fc5\u987b\u4fdd\u7559\u3002\u003C/p\u003E\n\n\u003Cblockquote\u003E\n\u003Cp\u003E\u5b58\u5728 \u003Ccode\u003E@Options\u003C/code\u003E \u6ce8\u89e3\u7684\u65b9\u6cd5\uff1a\u003C/p\u003E\n\n\u003Col class=\"task-list\"\u003E\n\u003Cli\u003E\u003Ccode\u003Etk.mybatis.mapper.common.special.InsertListMapper\u003C/code\u003E \n\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u003Ccode\u003Eint insertList(List\u0026lt;T\u0026gt; recordList);\u003C/code\u003E \u003C/li\u003E\n\u003C/ul\u003E\n\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003Etk.mybatis.mapper.common.special.InsertUseGeneratedKeysMapper\u003C/code\u003E \n\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u003Ccode\u003Eint insertUseGeneratedKeys(T record);\u003C/code\u003E \u003C/li\u003E\n\u003C/ul\u003E\n\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003Etk.mybatis.mapper.common.sqlserver.InsertMapper\u003C/code\u003E \n\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u003Ccode\u003Eint insert(T record);\u003C/code\u003E \u003C/li\u003E\n\u003C/ul\u003E\n\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003Etk.mybatis.mapper.common.sqlserver.InsertSelectiveMapper\u003C/code\u003E \n\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u003Ccode\u003Eint insertSelective(T record);\u003C/code\u003E \u003C/li\u003E\n\u003C/ul\u003E\n\u003C/li\u003E\n\u003C/ol\u003E\n\n\u003Cp\u003E\u003Cstrong\u003E\u8fd9 4 \u4e2a\u65b9\u6cd5\u90fd\u662f\u7279\u6b8a\u7684\u65b9\u6cd5\uff0c\u4e0d\u662f \u003Ccode\u003EMapper\u0026lt;T\u0026gt;\u003C/code\u003E \u63a5\u53e3\u4e2d\u5305\u542b\u7684\u4e24\u4e2a \u003Ccode\u003Einsert\u003C/code\u003E \u65b9\u6cd5\u3002\u003C/strong\u003E\u003C/p\u003E\n\u003C/blockquote\u003E\n\n\u003Cp\u003EMyBatis \u4e2d\u7684 \u003Ccode\u003E@Options\u003C/code\u003E \u6ce8\u89e3\u5728 3.3.x \u7248\u672c\u548c 3.4.0+ \u540e\u7684\u7248\u672c\u4e2d\uff0c\u5bf9 \u003Ccode\u003EflushCache\u003C/code\u003E \u65b9\u6cd5\u5b9a\u4e49\u4e0d\u540c\uff0c\u8fd9\u5c31\u5bfc\u81f4\u901a\u7528 Mapper \u4e2d\u65e0\u6cd5\u76f4\u63a5\u914d\u7f6e\u6539\u5c5e\u6027\uff0c\u5728 3.3.x \u7b49\u4f4e\u7248\u672c\u4e2d\uff0c\u8be5\u5c5e\u6027\u9ed8\u8ba4 \u003Ccode\u003Efalse\u003C/code\u003E\uff0c\u56e0\u6b64\u6267\u884c \u003Ccode\u003Einsert\u003C/code\u003E \u540e\u4e0d\u4f1a\u6e05\u9664\u4e00\u4e8c\u7ea7\u7f13\u5b58\u3002\u5728\u9ad8\u7248\u672c\u4e2d\u4e0d\u5b58\u5728\u8be5\u95ee\u9898\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u56e0\u6b64\u5982\u679c\u8981\u4f7f\u7528\u4e8c\u7ea7\u7f13\u5b58\uff0c\u5efa\u8bae MyBatis \u4f7f\u7528\u6bd4\u8f83\u65b0\u7684\u7248\u672c\uff0c\u5426\u5219\u9700\u8981\u8003\u8651\u4f7f\u7528 insert \u540e\u53ef\u80fd\u67e5\u8be2\u4e0d\u5230\u7684\u95ee\u9898\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u003Ccode\u003EOptions\u003C/code\u003E \u6ce8\u89e3\u4e2d\u7684 \u003Ccode\u003EflushCache\u003C/code\u003E \u533a\u522b\u5982\u4e0b\uff1a\u003C/p\u003E\n\n\u003Cp\u003E3.3.x \u4ee5\u53ca\u66f4\u65e7\u7684\u7248\u672c\u4e2d\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"kt\"\u003Eboolean\u003C/span\u003E \u003Cspan class=\"nf\"\u003EflushCache\u003C/span\u003E\u003Cspan class=\"o\"\u003E()\u003C/span\u003E \u003Cspan class=\"k\"\u003Edefault\u003C/span\u003E \u003Cspan class=\"kc\"\u003Efalse\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E3.4.0+\u4e2d\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"cm\"\u003E/**\n * The options for the {@link Options#flushCache()}.\n * The default is {@link FlushCachePolicy#DEFAULT}\n */\u003C/span\u003E\n\u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eenum\u003C/span\u003E \u003Cspan class=\"n\"\u003EFlushCachePolicy\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n    \u003Cspan class=\"cm\"\u003E/** \u0026lt;code\u0026gt;false\u0026lt;/code\u0026gt; for select statement; \u0026lt;code\u0026gt;true\u0026lt;/code\u0026gt; for insert/update/delete statement. */\u003C/span\u003E\n    \u003Cspan class=\"n\"\u003EDEFAULT\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E\n    \u003Cspan class=\"cm\"\u003E/** Flushes cache regardless of the statement type. */\u003C/span\u003E\n    \u003Cspan class=\"n\"\u003ETRUE\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E\n    \u003Cspan class=\"cm\"\u003E/** Does not flush cache regardless of the statement type. */\u003C/span\u003E\n    \u003Cspan class=\"n\"\u003EFALSE\u003C/span\u003E\n\u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\n\u003Cspan class=\"n\"\u003EFlushCachePolicy\u003C/span\u003E \u003Cspan class=\"nf\"\u003EflushCache\u003C/span\u003E\u003Cspan class=\"o\"\u003E()\u003C/span\u003E \u003Cspan class=\"k\"\u003Edefault\u003C/span\u003E \u003Cspan class=\"n\"\u003EFlushCachePolicy\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EDEFAULT\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u5f88\u663e\u7136\uff0c\u5728 3.4.0+ \u4e2d\u7684\u5b9a\u4e49\u66f4\u5408\u7406\uff0c\u6240\u4ee5\u5982\u679c\u4f7f\u7528\u4e8c\u7ea7\u7f13\u5b58\uff0c\u5efa\u8bae\u5347\u7ea7\u5230\u6bd4\u8f83\u65b0\u7684\u7248\u672c\u3002\u003C/p\u003E\n","217647":"\u003Ch3\u003E\u003Ca class=\"anchor\" id=\"7-2-typehandler-\u7c7b\u578b\u5904\u7406\u5668_1\" href=\"#7-2-typehandler-\u7c7b\u578b\u5904\u7406\u5668_1\"\u003E\u003C/a\u003E7.2 TypeHandler \u7c7b\u578b\u5904\u7406\u5668\u003C/h3\u003E\n\u003Cp\u003E\u672c\u6587\u901a\u8fc7\u4e24\u4e2a\u4f8b\u5b50\u6765\u6f14\u793a typeHandler \u7684\u7528\u6cd5\u3002\u003C/p\u003E\n\n\u003Cblockquote\u003E\n\u003Cp\u003E\u793a\u4f8b\u6765\u81ea \u003Ca href=\"https://github.com/abel533/Mapper/tree/master/base/src/test/java/tk/mybatis/mapper/typehandler\"\u003Ebase/src/test/java/tk.mybatis.mapper.typehandler\u003C/a\u003E \u5305\u4e2d\u7684\u6d4b\u8bd5\u3002\u003C/p\u003E\n\u003C/blockquote\u003E\n\n\u003Cp\u003E\u5728\u5f00\u59cb\u4f8b\u5b50\u524d\uff0c\u5148\u4e0a\u76f8\u540c\u7684\u4ee3\u7801\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u4e00\u4e2a\u7b80\u5355\u7684\u679a\u4e3e\u7c7b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eenum\u003C/span\u003E \u003Cspan class=\"n\"\u003EStateEnum\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n    \u003Cspan class=\"n\"\u003Edisabled\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E\n    \u003Cspan class=\"n\"\u003Eenabled\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E\n\u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u8fd9\u91cc\u6253\u7b97\u7528 MyBatis \u63d0\u4f9b\u7684 \u003Ccode\u003EEnumOrdinalTypeHandler\u003C/code\u003E\uff0c\u4e5f\u662f\u6570\u636e\u5e93\u5b58\u50a8\u679a\u4e3e\u5bf9\u5e94\u7684\u5e8f\u53f7\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u4e00\u4e2a\u7b80\u5355\u7684\u5730\u5740\u7c7b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eclass\u003C/span\u003E \u003Cspan class=\"nc\"\u003EAddress\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eimplements\u003C/span\u003E \u003Cspan class=\"n\"\u003ESerializable\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n    \u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"kd\"\u003Estatic\u003C/span\u003E \u003Cspan class=\"kd\"\u003Efinal\u003C/span\u003E \u003Cspan class=\"kt\"\u003Elong\u003C/span\u003E \u003Cspan class=\"n\"\u003EserialVersionUID\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"mi\"\u003E1L\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n    \u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"n\"\u003EString\u003C/span\u003E \u003Cspan class=\"n\"\u003Eprovince\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n    \u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"n\"\u003EString\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecity\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n\n    \u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"n\"\u003EString\u003C/span\u003E \u003Cspan class=\"nf\"\u003EgetProvince\u003C/span\u003E\u003Cspan class=\"o\"\u003E()\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n        \u003Cspan class=\"k\"\u003Ereturn\u003C/span\u003E \u003Cspan class=\"n\"\u003Eprovince\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n    \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\n    \u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kt\"\u003Evoid\u003C/span\u003E \u003Cspan class=\"nf\"\u003EsetProvince\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EString\u003C/span\u003E \u003Cspan class=\"n\"\u003Eprovince\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n        \u003Cspan class=\"k\"\u003Ethis\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eprovince\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003Eprovince\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n    \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\n    \u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"n\"\u003EString\u003C/span\u003E \u003Cspan class=\"nf\"\u003EgetCity\u003C/span\u003E\u003Cspan class=\"o\"\u003E()\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n        \u003Cspan class=\"k\"\u003Ereturn\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecity\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n    \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\n    \u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kt\"\u003Evoid\u003C/span\u003E \u003Cspan class=\"nf\"\u003EsetCity\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EString\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecity\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n        \u003Cspan class=\"k\"\u003Ethis\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Ecity\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecity\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n    \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\n    \u003Cspan class=\"nd\"\u003E@Override\u003C/span\u003E\n    \u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"n\"\u003EString\u003C/span\u003E \u003Cspan class=\"nf\"\u003EtoString\u003C/span\u003E\u003Cspan class=\"o\"\u003E()\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003EStringBuilder\u003C/span\u003E \u003Cspan class=\"n\"\u003Ebuilder\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"k\"\u003Enew\u003C/span\u003E \u003Cspan class=\"n\"\u003EStringBuilder\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n        \u003Cspan class=\"k\"\u003Eif\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Eprovince\u003C/span\u003E \u003Cspan class=\"o\"\u003E!=\u003C/span\u003E \u003Cspan class=\"kc\"\u003Enull\u003C/span\u003E \u003Cspan class=\"o\"\u003E\u0026amp;\u0026amp;\u003C/span\u003E \u003Cspan class=\"n\"\u003Eprovince\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Elength\u003C/span\u003E\u003Cspan class=\"o\"\u003E()\u003C/span\u003E \u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"mi\"\u003E0\u003C/span\u003E\u003Cspan class=\"o\"\u003E){\u003C/span\u003E\n            \u003Cspan class=\"n\"\u003Ebuilder\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eappend\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Eprovince\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n        \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n        \u003Cspan class=\"k\"\u003Eif\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Ecity\u003C/span\u003E \u003Cspan class=\"o\"\u003E!=\u003C/span\u003E \u003Cspan class=\"kc\"\u003Enull\u003C/span\u003E \u003Cspan class=\"o\"\u003E\u0026amp;\u0026amp;\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecity\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Elength\u003C/span\u003E\u003Cspan class=\"o\"\u003E()\u003C/span\u003E \u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"mi\"\u003E0\u003C/span\u003E\u003Cspan class=\"o\"\u003E){\u003C/span\u003E\n            \u003Cspan class=\"n\"\u003Ebuilder\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eappend\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"/\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E).\u003C/span\u003E\u003Cspan class=\"na\"\u003Eappend\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Ecity\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n        \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n        \u003Cspan class=\"k\"\u003Ereturn\u003C/span\u003E \u003Cspan class=\"n\"\u003Ebuilder\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EtoString\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n    \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u8fd9\u4e2a\u7c7b\u7528\u6765\u6f14\u793a\u81ea\u5b9a\u4e49\u7c7b\u578b\u7684\u7528\u6cd5\uff0c\u9488\u5bf9\u8be5\u7c7b\u5199\u4e00\u4e2a\u81ea\u5b9a\u4e49\u7684 TypeHandler\uff0c\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eclass\u003C/span\u003E \u003Cspan class=\"nc\"\u003EAddressTypeHandler\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eextends\u003C/span\u003E \u003Cspan class=\"n\"\u003EBaseTypeHandler\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003EAddress\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n    \u003Cspan class=\"nd\"\u003E@Override\u003C/span\u003E\n    \u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kt\"\u003Evoid\u003C/span\u003E \u003Cspan class=\"nf\"\u003EsetNonNullParameter\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EPreparedStatement\u003C/span\u003E \u003Cspan class=\"n\"\u003Eps\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E \u003Cspan class=\"kt\"\u003Eint\u003C/span\u003E \u003Cspan class=\"n\"\u003Ei\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E \u003Cspan class=\"n\"\u003EAddress\u003C/span\u003E \u003Cspan class=\"n\"\u003Eparameter\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E\n                                    \u003Cspan class=\"n\"\u003EJdbcType\u003C/span\u003E \u003Cspan class=\"n\"\u003EjdbcType\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E \u003Cspan class=\"kd\"\u003Ethrows\u003C/span\u003E \u003Cspan class=\"n\"\u003ESQLException\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003Eps\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EsetString\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Ei\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E \u003Cspan class=\"n\"\u003Eparameter\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EtoString\u003C/span\u003E\u003Cspan class=\"o\"\u003E());\u003C/span\u003E\n    \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\n    \u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"n\"\u003EAddress\u003C/span\u003E \u003Cspan class=\"nf\"\u003EconvertToAddress\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EString\u003C/span\u003E \u003Cspan class=\"n\"\u003EaddressStr\u003C/span\u003E\u003Cspan class=\"o\"\u003E){\u003C/span\u003E\n        \u003Cspan class=\"k\"\u003Eif\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EaddressStr\u003C/span\u003E \u003Cspan class=\"o\"\u003E==\u003C/span\u003E \u003Cspan class=\"kc\"\u003Enull\u003C/span\u003E \u003Cspan class=\"o\"\u003E||\u003C/span\u003E \u003Cspan class=\"n\"\u003EaddressStr\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Elength\u003C/span\u003E\u003Cspan class=\"o\"\u003E()\u003C/span\u003E \u003Cspan class=\"o\"\u003E==\u003C/span\u003E \u003Cspan class=\"mi\"\u003E0\u003C/span\u003E\u003Cspan class=\"o\"\u003E){\u003C/span\u003E\n            \u003Cspan class=\"k\"\u003Ereturn\u003C/span\u003E \u003Cspan class=\"kc\"\u003Enull\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n        \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003EString\u003C/span\u003E\u003Cspan class=\"o\"\u003E[]\u003C/span\u003E \u003Cspan class=\"n\"\u003Estrings\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003EaddressStr\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Esplit\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"/\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003EAddress\u003C/span\u003E \u003Cspan class=\"n\"\u003Eaddress\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"k\"\u003Enew\u003C/span\u003E \u003Cspan class=\"n\"\u003EAddress\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n        \u003Cspan class=\"k\"\u003Eif\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Estrings\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Elength\u003C/span\u003E \u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"mi\"\u003E0\u003C/span\u003E \u003Cspan class=\"o\"\u003E\u0026amp;\u0026amp;\u003C/span\u003E \u003Cspan class=\"n\"\u003Estrings\u003C/span\u003E\u003Cspan class=\"o\"\u003E[\u003C/span\u003E\u003Cspan class=\"mi\"\u003E0\u003C/span\u003E\u003Cspan class=\"o\"\u003E].\u003C/span\u003E\u003Cspan class=\"na\"\u003Elength\u003C/span\u003E\u003Cspan class=\"o\"\u003E()\u003C/span\u003E \u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"mi\"\u003E0\u003C/span\u003E\u003Cspan class=\"o\"\u003E){\u003C/span\u003E\n            \u003Cspan class=\"n\"\u003Eaddress\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EsetProvince\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Estrings\u003C/span\u003E\u003Cspan class=\"o\"\u003E[\u003C/span\u003E\u003Cspan class=\"mi\"\u003E0\u003C/span\u003E\u003Cspan class=\"o\"\u003E]);\u003C/span\u003E\n        \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n        \u003Cspan class=\"k\"\u003Eif\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Estrings\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Elength\u003C/span\u003E \u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"mi\"\u003E1\u003C/span\u003E \u003Cspan class=\"o\"\u003E\u0026amp;\u0026amp;\u003C/span\u003E \u003Cspan class=\"n\"\u003Estrings\u003C/span\u003E\u003Cspan class=\"o\"\u003E[\u003C/span\u003E\u003Cspan class=\"mi\"\u003E1\u003C/span\u003E\u003Cspan class=\"o\"\u003E].\u003C/span\u003E\u003Cspan class=\"na\"\u003Elength\u003C/span\u003E\u003Cspan class=\"o\"\u003E()\u003C/span\u003E \u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"mi\"\u003E0\u003C/span\u003E\u003Cspan class=\"o\"\u003E){\u003C/span\u003E\n            \u003Cspan class=\"n\"\u003Eaddress\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EsetCity\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Estrings\u003C/span\u003E\u003Cspan class=\"o\"\u003E[\u003C/span\u003E\u003Cspan class=\"mi\"\u003E1\u003C/span\u003E\u003Cspan class=\"o\"\u003E]);\u003C/span\u003E\n        \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n        \u003Cspan class=\"k\"\u003Ereturn\u003C/span\u003E \u003Cspan class=\"n\"\u003Eaddress\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n    \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\n    \u003Cspan class=\"nd\"\u003E@Override\u003C/span\u003E\n    \u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"n\"\u003EAddress\u003C/span\u003E \u003Cspan class=\"nf\"\u003EgetNullableResult\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EResultSet\u003C/span\u003E \u003Cspan class=\"n\"\u003Ers\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E \u003Cspan class=\"n\"\u003EString\u003C/span\u003E \u003Cspan class=\"n\"\u003EcolumnName\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E \u003Cspan class=\"kd\"\u003Ethrows\u003C/span\u003E \u003Cspan class=\"n\"\u003ESQLException\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n        \u003Cspan class=\"k\"\u003Ereturn\u003C/span\u003E \u003Cspan class=\"nf\"\u003EconvertToAddress\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Ers\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EgetString\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EcolumnName\u003C/span\u003E\u003Cspan class=\"o\"\u003E));\u003C/span\u003E\n    \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\n    \u003Cspan class=\"nd\"\u003E@Override\u003C/span\u003E\n    \u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"n\"\u003EAddress\u003C/span\u003E \u003Cspan class=\"nf\"\u003EgetNullableResult\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EResultSet\u003C/span\u003E \u003Cspan class=\"n\"\u003Ers\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E \u003Cspan class=\"kt\"\u003Eint\u003C/span\u003E \u003Cspan class=\"n\"\u003EcolumnIndex\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E \u003Cspan class=\"kd\"\u003Ethrows\u003C/span\u003E \u003Cspan class=\"n\"\u003ESQLException\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n        \u003Cspan class=\"k\"\u003Ereturn\u003C/span\u003E \u003Cspan class=\"nf\"\u003EconvertToAddress\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Ers\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EgetString\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EcolumnIndex\u003C/span\u003E\u003Cspan class=\"o\"\u003E));\u003C/span\u003E\n    \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\n    \u003Cspan class=\"nd\"\u003E@Override\u003C/span\u003E\n    \u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"n\"\u003EAddress\u003C/span\u003E \u003Cspan class=\"nf\"\u003EgetNullableResult\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003ECallableStatement\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecs\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E \u003Cspan class=\"kt\"\u003Eint\u003C/span\u003E \u003Cspan class=\"n\"\u003EcolumnIndex\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n            \u003Cspan class=\"kd\"\u003Ethrows\u003C/span\u003E \u003Cspan class=\"n\"\u003ESQLException\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n        \u003Cspan class=\"k\"\u003Ereturn\u003C/span\u003E \u003Cspan class=\"nf\"\u003EconvertToAddress\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Ecs\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EgetString\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EcolumnIndex\u003C/span\u003E\u003Cspan class=\"o\"\u003E));\u003C/span\u003E\n    \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u6d4b\u8bd5\u6570\u636e\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"k\"\u003Ecreate\u003C/span\u003E \u003Cspan class=\"k\"\u003Etable\u003C/span\u003E \u003Cspan class=\"k\"\u003Euser\u003C/span\u003E \u003Cspan class=\"p\"\u003E(\u003C/span\u003E\n  \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E \u003Cspan class=\"n\"\u003Einteger\u003C/span\u003E \u003Cspan class=\"k\"\u003ENOT\u003C/span\u003E \u003Cspan class=\"k\"\u003ENULL\u003C/span\u003E \u003Cspan class=\"k\"\u003EPRIMARY\u003C/span\u003E \u003Cspan class=\"k\"\u003EKEY\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E\n  \u003Cspan class=\"n\"\u003Ename\u003C/span\u003E \u003Cspan class=\"n\"\u003Evarchar\u003C/span\u003E\u003Cspan class=\"p\"\u003E(\u003C/span\u003E\u003Cspan class=\"mi\"\u003E32\u003C/span\u003E\u003Cspan class=\"p\"\u003E),\u003C/span\u003E\n  \u003Cspan class=\"n\"\u003Eaddress\u003C/span\u003E \u003Cspan class=\"n\"\u003Evarchar\u003C/span\u003E\u003Cspan class=\"p\"\u003E(\u003C/span\u003E\u003Cspan class=\"mi\"\u003E64\u003C/span\u003E\u003Cspan class=\"p\"\u003E),\u003C/span\u003E\n  \u003Cspan class=\"k\"\u003Estate\u003C/span\u003E \u003Cspan class=\"n\"\u003Einteger\u003C/span\u003E\n\u003Cspan class=\"p\"\u003E);\u003C/span\u003E\n\n\u003Cspan class=\"k\"\u003EINSERT\u003C/span\u003E \u003Cspan class=\"k\"\u003EINTO\u003C/span\u003E \u003Cspan class=\"k\"\u003Euser\u003C/span\u003E \u003Cspan class=\"p\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Eid\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E \u003Cspan class=\"n\"\u003Ename\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E \u003Cspan class=\"n\"\u003Eaddress\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E \u003Cspan class=\"k\"\u003Estate\u003C/span\u003E\u003Cspan class=\"p\"\u003E)\u003C/span\u003E \u003Cspan class=\"k\"\u003EVALUES\u003C/span\u003E \u003Cspan class=\"p\"\u003E(\u003C/span\u003E\u003Cspan class=\"mi\"\u003E1\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E \u003Cspan class=\"s1\"\u003E'abel533'\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E \u003Cspan class=\"s1\"\u003E'Hebei/Shijiazhuang'\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E \u003Cspan class=\"mi\"\u003E1\u003C/span\u003E\u003Cspan class=\"p\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"k\"\u003EINSERT\u003C/span\u003E \u003Cspan class=\"k\"\u003EINTO\u003C/span\u003E \u003Cspan class=\"k\"\u003Euser\u003C/span\u003E \u003Cspan class=\"p\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Eid\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E \u003Cspan class=\"n\"\u003Ename\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E \u003Cspan class=\"n\"\u003Eaddress\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E \u003Cspan class=\"k\"\u003Estate\u003C/span\u003E\u003Cspan class=\"p\"\u003E)\u003C/span\u003E \u003Cspan class=\"k\"\u003EVALUES\u003C/span\u003E \u003Cspan class=\"p\"\u003E(\u003C/span\u003E\u003Cspan class=\"mi\"\u003E2\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E \u003Cspan class=\"s1\"\u003E'isea533'\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E \u003Cspan class=\"s1\"\u003E'Hebei/Handan'\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E \u003Cspan class=\"mi\"\u003E0\u003C/span\u003E\u003Cspan class=\"p\"\u003E);\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003E\u7279\u522b\u6ce8\u610f\uff0cstate \u5bf9\u5e94\u7684 0 \u5c31\u662f\u679a\u4e3e\u7b2c\u4e00\u4e2a disabled\uff0c1 \u5c31\u662f\u679a\u4e3e\u7b2c\u4e8c\u4e2a enabled\u3002\u003C/p\u003E\n\u003C/blockquote\u003E\n\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"7-2-1-\u4f7f\u7528-columntype-\u6ce8\u89e3\u6307\u5b9a_1\" href=\"#7-2-1-\u4f7f\u7528-columntype-\u6ce8\u89e3\u6307\u5b9a_1\"\u003E\u003C/a\u003E7.2.1 \u4f7f\u7528 ColumnType \u6ce8\u89e3\u6307\u5b9a\u003C/h4\u003E\n\u003Cp\u003E\u521b\u5efa user \u8868\u5bf9\u5e94\u7684 User \u5b9e\u4f53\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eclass\u003C/span\u003E \u003Cspan class=\"nc\"\u003EUser\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eimplements\u003C/span\u003E \u003Cspan class=\"n\"\u003ESerializable\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n    \u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"kd\"\u003Estatic\u003C/span\u003E \u003Cspan class=\"kd\"\u003Efinal\u003C/span\u003E \u003Cspan class=\"kt\"\u003Elong\u003C/span\u003E \u003Cspan class=\"n\"\u003EserialVersionUID\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"mi\"\u003E1L\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n    \u003Cspan class=\"nd\"\u003E@Id\u003C/span\u003E\n    \u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"n\"\u003EInteger\u003C/span\u003E   \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n    \u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"n\"\u003EString\u003C/span\u003E    \u003Cspan class=\"n\"\u003Ename\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n    \u003Cspan class=\"nd\"\u003E@ColumnType\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EtypeHandler\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003EAddressTypeHandler\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eclass\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n    \u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"n\"\u003EAddress\u003C/span\u003E   \u003Cspan class=\"n\"\u003Eaddress\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n    \u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"n\"\u003EStateEnum\u003C/span\u003E \u003Cspan class=\"n\"\u003Estate\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n\n    \u003Cspan class=\"c1\"\u003E//\u7701\u7565 setter \u548c getter\u003C/span\u003E\n\u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003E\u003Cstrong\u003E\u7279\u522b\u63d0\u9192\u003C/strong\u003E\u003C/p\u003E\n\n\u003Col class=\"task-list\"\u003E\n\u003Cli\u003E\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u53ea\u6709\u7b80\u5355\u7c7b\u578b\u624d\u4f1a\u88ab\u5f53\u4f5c\u8868\u4e2d\u7684\u5b57\u6bb5(\u003Ccode\u003EuseSimpleType=true\u003C/code\u003E)\u3002\u003C/li\u003E\n\u003Cli\u003E\u5f53\u5b57\u6bb5\u6709 \u003Ccode\u003E@Column\u003C/code\u003E \u6216\u8005 \u003Ccode\u003E@ColumnType\u003C/code\u003E \u6ce8\u89e3\u65f6\uff0c\u4e5f\u4f1a\u88ab\u5f53\u4f5c\u8868\u4e2d\u7684\u5b57\u6bb5\u3002\u003C/li\u003E\n\u003Cli\u003E\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u679a\u4e3e\u4e0d\u4f1a\u5f53\u4f5c\u8868\u4e2d\u7684\u5b57\u6bb5\uff0c\u5982\u679c\u60f3\u8981\u81ea\u52a8\u628a\u679a\u4e3e\u4f5c\u4e3a\u8868\u4e2d\u5b57\u6bb5\uff0c\u9700\u8981\u914d\u7f6e \u003Ccode\u003EenumAsSimpleType=true\u003C/code\u003E\uff0c\u003Cstrong\u003E\u8fd9\u91cc\u7684\u4f8b\u5b50\u5c31\u542f\u7528\u4e86\u8fd9\u4e2a\u914d\u7f6e\u003C/strong\u003E\u3002\u5982\u679c\u4e0d\u542f\u7528\u8fd9\u4e2a\u529f\u80fd\uff0c\u4e5f\u9700\u8981\u52a0  \u003Ccode\u003E@Column\u003C/code\u003E \u6216\u8005 \u003Ccode\u003E@ColumnType\u003C/code\u003E \u6ce8\u89e3\u3002\u003C/li\u003E\n\u003C/ol\u003E\n\u003C/blockquote\u003E\n\n\u003Cp\u003E\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u003Ccode\u003Eaddress\u003C/code\u003E \u5b57\u6bb5\u901a\u8fc7 \u003Ccode\u003E@ColumnType\u003C/code\u003E \u8bbe\u7f6e\u4e86 \u003Ccode\u003EtypeHandler\u003C/code\u003E\u3002\u4f46\u662f \u003Ccode\u003Estate\u003C/code\u003E \u5374\u6ca1\u8fd9\u4e48\u8bbe\u7f6e\uff0c\u5148\u770b \u003Ccode\u003EEnumOrdinalTypeHandler\u003C/code\u003E \u7684\u5b9a\u4e49\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eclass\u003C/span\u003E \u003Cspan class=\"nc\"\u003EEnumOrdinalTypeHandler\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003EE\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eextends\u003C/span\u003E \u003Cspan class=\"n\"\u003EEnum\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003EE\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u0026gt;\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eextends\u003C/span\u003E \u003Cspan class=\"n\"\u003EBaseTypeHandler\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003EE\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u7531\u4e8e\u9700\u8981\u6307\u5b9a\u6cdb\u578b\uff0c\u56e0\u6b64\u8fd9\u91cc\u4e0d\u80fd\u76f4\u63a5\u914d\u7f6e\uff0c\u9664\u975e\u4f60\u5728\u521b\u5efa\u4e00\u4e2a\u9488\u5bf9\u6027\u7684 TypeHandler\uff0c\u4f8b\u5982\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eclass\u003C/span\u003E \u003Cspan class=\"nc\"\u003EStateEnumTypeHandler\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eextends\u003C/span\u003E \u003Cspan class=\"n\"\u003EEnumOrdinalTypeHandler\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003EStateEnum\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n    \u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"nf\"\u003EStateEnumTypeHandler\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EClass\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003EStateEnum\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"n\"\u003Etype\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n        \u003Cspan class=\"kd\"\u003Esuper\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Etype\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n    \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u7136\u540e\u914d\u7f6e\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nd\"\u003E@ColumnType\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EtypeHandler\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003EStateEnumTypeHandler\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eclass\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n\u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"n\"\u003EStateEnum\u003C/span\u003E \u003Cspan class=\"n\"\u003Estate\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u9664\u4e86\u7528\u8fd9\u79cd\u9ebb\u70e6\u7684\u65b9\u5f0f\u5916\uff0c\u8fd8\u53ef\u4ee5\u76f4\u63a5\u7528\u4e0b\u9762\u7684\u65b9\u5f0f\u914d\u7f6e\u5168\u5c40\u7684 typeHandler\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"cp\"\u003E\u0026lt;!DOCTYPE configuration\n        PUBLIC \"-//mybatis.org//DTD Config 3.0//EN\"\n        \"http://mybatis.org/dtd/mybatis-3-config.dtd\"\u0026gt;\u003C/span\u003E\n\n\u003Cspan class=\"nt\"\u003E\u0026lt;configuration\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"c\"\u003E\u0026lt;!-- \u5176\u4ed6\u914d\u7f6e --\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"nt\"\u003E\u0026lt;typeHandlers\u0026gt;\u003C/span\u003E\n        \u003Cspan class=\"nt\"\u003E\u0026lt;typeHandler\u003C/span\u003E \n                \u003Cspan class=\"na\"\u003Ehandler=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"org.apache.ibatis.type.EnumOrdinalTypeHandler\"\u003C/span\u003E \n                \u003Cspan class=\"na\"\u003EjavaType=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"tk.mybatis.mapper.typehandler.StateEnum\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E/\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"nt\"\u003E\u0026lt;/typeHandlers\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"c\"\u003E\u0026lt;!-- \u5176\u4ed6\u914d\u7f6e --\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/configuration\u0026gt;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u6709\u4e86\u8fd9\u4e9b\u914d\u7f6e\u540e\uff0c\u5c31\u53ef\u4ee5\u5728\u589e\u5220\u6539\u67e5\u4f7f\u7528\u4e86\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u8fd9\u4e2a\u4f8b\u5b50\u5bf9\u5e94\u7684\u6d4b\u8bd5\uff1a \u003Ca href=\"https://github.com/abel533/Mapper/blob/master/base/src/test/java/tk/mybatis/mapper/typehandler/TypeHandlerTest.java\"\u003E\u003Ccode\u003Etk.mybatis.mapper.typehandler.TypeHandlerTest\u003C/code\u003E\u003C/a\u003E\u3002\u003C/p\u003E\n\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"7-2-2-\u5168\u5c40\u914d\u7f6e_1\" href=\"#7-2-2-\u5168\u5c40\u914d\u7f6e_1\"\u003E\u003C/a\u003E7.2.2 \u5168\u5c40\u914d\u7f6e\u003C/h4\u003E\n\u003Cp\u003E\u7b2c\u4e8c\u79cd\u5c31\u662f\u5168\u90e8\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u4f7f\u7528 typeHandler \u8fdb\u884c\u914d\u7f6e\uff0c\u5b9e\u4f53\u53ea\u505a\u7b80\u5355\u7684\u914d\u7f6e\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nd\"\u003E@Table\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Ename\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"s\"\u003E\"user\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n\u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eclass\u003C/span\u003E \u003Cspan class=\"nc\"\u003EUser2\u003C/span\u003E \u003Cspan class=\"kd\"\u003Eimplements\u003C/span\u003E \u003Cspan class=\"n\"\u003ESerializable\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n    \u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"kd\"\u003Estatic\u003C/span\u003E \u003Cspan class=\"kd\"\u003Efinal\u003C/span\u003E \u003Cspan class=\"kt\"\u003Elong\u003C/span\u003E \u003Cspan class=\"n\"\u003EserialVersionUID\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"mi\"\u003E1L\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n    \u003Cspan class=\"nd\"\u003E@Id\u003C/span\u003E\n    \u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"n\"\u003EInteger\u003C/span\u003E   \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n    \u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"n\"\u003EString\u003C/span\u003E    \u003Cspan class=\"n\"\u003Ename\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n    \u003Cspan class=\"nd\"\u003E@Column\u003C/span\u003E\n    \u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"n\"\u003EAddress\u003C/span\u003E   \u003Cspan class=\"n\"\u003Eaddress\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n    \u003Cspan class=\"kd\"\u003Eprivate\u003C/span\u003E \u003Cspan class=\"n\"\u003EStateEnum\u003C/span\u003E \u003Cspan class=\"n\"\u003Estate\u003C/span\u003E\u003Cspan class=\"o\"\u003E;\u003C/span\u003E\n\n    \u003Cspan class=\"c1\"\u003E//\u7701\u7565 setter \u548c getter\u003C/span\u003E\n\u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u8fd9\u91cc\u7684 \u003Ccode\u003EAddress\u003C/code\u003E \u52a0\u4e0a \u003Ccode\u003E@Column\u003C/code\u003E \u6ce8\u89e3\uff0c\u53ea\u662f\u4e3a\u4e86\u628a\u8be5\u5b57\u6bb5\u5f53\u6210\u8868\u4e2d\u7684\u5b57\u6bb5\u3002\u003C/p\u003E\n\n\u003Cp\u003EtypeHandler \u5168\u5c40\u914d\u7f6e\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nt\"\u003E\u0026lt;typeHandlers\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"nt\"\u003E\u0026lt;typeHandler\u003C/span\u003E \n                 \u003Cspan class=\"na\"\u003Ehandler=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"org.apache.ibatis.type.EnumOrdinalTypeHandler\"\u003C/span\u003E \n                 \u003Cspan class=\"na\"\u003EjavaType=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"tk.mybatis.mapper.typehandler.StateEnum\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E/\u0026gt;\u003C/span\u003E\n\n    \u003Cspan class=\"nt\"\u003E\u0026lt;typeHandler\u003C/span\u003E \u003Cspan class=\"na\"\u003Ehandler=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"tk.mybatis.mapper.typehandler.AddressTypeHandler\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E/\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/typeHandlers\u0026gt;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u505a\u597d\u8fd9\u4e9b\u914d\u7f6e\u540e\uff0c\u5c31\u53ef\u4ee5\u5728\u589e\u5220\u6539\u67e5\u4f7f\u7528\u4e86\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u8fd9\u4e2a\u4f8b\u5b50\u5bf9\u5e94\u7684\u6d4b\u8bd5\uff1a \u003Ca href=\"https://github.com/abel533/Mapper/blob/master/base/src/test/java/tk/mybatis/mapper/typehandler/TypeHandlerTest2.java\"\u003E\u003Ccode\u003Etk.mybatis.mapper.typehandler.TypeHandlerTest2\u003C/code\u003E\u003C/a\u003E\u3002\u003C/p\u003E\n","14104":"\u003Ch1\u003E\u003Ca class=\"anchor\" id=\"mybatis-\u901a\u7528-mapper4_1\" href=\"#mybatis-\u901a\u7528-mapper4_1\"\u003E\u003C/a\u003EMyBatis \u901a\u7528 Mapper4\u003C/h1\u003E\n\u003Cp\u003E\u003Ca href=\"https://travis-ci.org/abel533/Mapper\"\u003E\u003Cimg alt=\"Build Status\" src=\"https://travis-ci.org/abel533/Mapper.svg?branch=master\" /\u003E\u003C/a\u003E\n\u003Ca href=\"https://maven-badges.herokuapp.com/maven-central/tk.mybatis/mapper\"\u003E\u003Cimg alt=\"Maven central\" src=\"https://maven-badges.herokuapp.com/maven-central/tk.mybatis/mapper/badge.svg\" /\u003E\u003C/a\u003E\n\u003Ca href=\"https://www.versioneye.com/user/projects/593212c722f278006540a1d1\"\u003E\u003Cimg alt=\"Dependency Status\" src=\"https://www.versioneye.com/user/projects/593212c722f278006540a1d1/badge.svg?style=flat\" /\u003E\u003C/a\u003E\u003C/p\u003E\n\n\u003Cp\u003E\u901a\u7528 Mapper4 \u662f\u4e00\u4e2a\u53ef\u4ee5\u5b9e\u73b0\u4efb\u610f MyBatis \u901a\u7528\u65b9\u6cd5\u7684\u6846\u67b6\uff0c\u9879\u76ee\u63d0\u4f9b\u4e86\u5e38\u89c4\u7684\u589e\u5220\u6539\u67e5\u64cd\u4f5c\u4ee5\u53ca\u003Ccode\u003EExample\u003C/code\u003E \u76f8\u5173\u7684\u5355\u8868\u64cd\u4f5c\u3002\u901a\u7528 Mapper \u662f\u4e3a\u4e86\u89e3\u51b3 MyBatis \u4f7f\u7528\u4e2d 90% \u7684\u57fa\u672c\u64cd\u4f5c\uff0c\u4f7f\u7528\u5b83\u53ef\u4ee5\u5f88\u65b9\u4fbf\u7684\u8fdb\u884c\u5f00\u53d1\uff0c\u53ef\u4ee5\u8282\u7701\u5f00\u53d1\u4eba\u5458\u5927\u91cf\u7684\u65f6\u95f4\u3002\u003C/p\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"\u901a\u7528-mapper-4-\u548c-3-\u7684\u533a\u522b_1\" href=\"#\u901a\u7528-mapper-4-\u548c-3-\u7684\u533a\u522b_1\"\u003E\u003C/a\u003E\u901a\u7528 Mapper 4 \u548c 3 \u7684\u533a\u522b\u003C/h2\u003E\n\u003Col class=\"task-list\"\u003E\n\u003Cli\u003E \u6700\u5927\u7684\u533a\u522b\u5c31\u662f mapper4 \u628a mapper3 \u62c6\u6210\u4e86 base, core, extra,generator, spring 5\u4e2a\u9879\u76ee\uff0c\u5e76\u4e14\u628a weekend \u548c spring-boot-starter \u4e24\u4e2a\u9879\u76ee\u4e5f\u52a0\u5165\u8fdb\u6765\u3002\u003C/li\u003E\n\u003Cli\u003E Mapper 4 \u9ed8\u8ba4\u4e0d\u9700\u8981\u4efb\u4f55\u914d\u7f6e\uff0c\u81ea\u52a8\u6ce8\u518c\u63a5\u53e3\uff08\u4e0d\u9700\u8981 \u003Ccode\u003Emappers\u003C/code\u003E \u53c2\u6570\uff09\uff0c\u9700\u8981\u57fa\u7c7b\u63a5\u53e3\u6807\u8bb0 \u003Ccode\u003E@RegisterMapper\u003C/code\u003E \u6ce8\u89e3\u3002\u003C/li\u003E\n\u003Cli\u003E \u5728\u5e38\u89c4\u7528\u6cd5\u4e2d\uff0c\u8fd8\u53ef\u4ee5\u76f4\u63a5\u5f15\u5165 \u003Ccode\u003Etk.mybatis:mapper:\u7248\u672c\u53f7\u003C/code\u003E\uff0c\u5347\u7ea7\u7248\u672c\u5373\u53ef\u3002\u003C/li\u003E\n\u003Cli\u003E \u62c6\u5206\u9879\u76ee\u540e\uff0c\u9664\u4e86\u7b2c 3 \u6761\u7684\u5e38\u89c4\u65b9\u6cd5\u5916\uff0c\u8fd8\u53ef\u4ee5\u6309\u9700\u914d\u7f6e\u4f9d\u8d56\uff0c\u6838\u5fc3\u53ea\u9700\u8981\u4e00\u4e2a \u003Ccode\u003Ecore\u003C/code\u003E\uff0c\u5176\u4ed6\u7684\u90fd\u662f\u5728\u6b64\u57fa\u7840\u4e0a\u8fdb\u884c\u7684\u6269\u5c55\u3001\u65b9\u6cd5\u5b9e\u73b0\u6216\u8005\u96c6\u6210\u3002\u003C/li\u003E\n\u003Cli\u003E \u548c spring \u96c6\u6210\u7684\u66f4\u5f7b\u5e95\uff0c\u4e0d\u4f1a\u51fa\u73b0\u4ee5\u524d\u7684\u4e00\u4e9b\u5e38\u89c1\u95ee\u9898\u3002\u003C/li\u003E\n\u003C/ol\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"\u4f7f\u7528\u6587\u6863_1\" href=\"#\u4f7f\u7528\u6587\u6863_1\"\u003E\u003C/a\u003E\u4f7f\u7528\u6587\u6863\u003C/h2\u003E\n\u003Cp\u003E\u521d\u6b21\u4f7f\u7528\u65f6\uff0c\u8bf7\u6309\u7167\u4e0b\u9762\u7684\u6587\u6863\u987a\u5e8f\u4f9d\u6b21\u9605\u8bfb\uff0c\u4f7f\u7528\u4e2d\u9047\u5230\u7684\u95ee\u9898\u65f6\uff0c\u53ef\u4ee5\u53c2\u8003\u76f8\u5e94\u7684\u6587\u6863\u6765\u67e5\u770b\u3002\u003C/p\u003E\n\n\u003Col class=\"task-list\"\u003E\n\u003Cli\u003E \u003Ca href=\"1.integration\" class=\"md_relative_url\"\u003E\u96c6\u6210\u901a\u7528 Mapper\u003C/a\u003E\n\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E \u003Ca href=\"1.1-java\" class=\"md_relative_url\"\u003E1.1 Java \u7f16\u7801\u65b9\u5f0f\u003C/a\u003E\u003C/li\u003E\n\u003Cli\u003E \u003Ca href=\"1.2-spring\" class=\"md_relative_url\"\u003E1.2 \u548c Spring \u96c6\u6210\u003C/a\u003E\u003C/li\u003E\n\u003Cli\u003E \u003Ca href=\"1.3-spring-boot\" class=\"md_relative_url\"\u003E1.3 \u548c Spring Boot \u96c6\u6210\u003C/a\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003C/li\u003E\n\u003Cli\u003E \u003Ca href=\"2.orm\" class=\"md_relative_url\"\u003E\u5bf9\u8c61\u5173\u7cfb\u6620\u5c04\u003C/a\u003E\n\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E \u003Ca href=\"2.1-simple\" class=\"md_relative_url\"\u003E2.1 \u7b80\u5355\u793a\u4f8b\u003C/a\u003E\u003C/li\u003E\n\u003Cli\u003E \u003Ca href=\"2.2-mapping\" class=\"md_relative_url\"\u003E2.2 \u6570\u636e\u5e93\u6620\u5c04\u003C/a\u003E\u003C/li\u003E\n\u003Cli\u003E \u003Ca href=\"2.3-generatedvalue\" class=\"md_relative_url\"\u003E2.3 \u4e3b\u952e\u7b56\u7565\u003C/a\u003E\u003C/li\u003E\n\u003Cli\u003E \u003Ca href=\"2.4-version\" class=\"md_relative_url\"\u003E2.4 \u4e50\u89c2\u9501\u003C/a\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003C/li\u003E\n\u003Cli\u003E \u003Ca href=\"3.config\" class=\"md_relative_url\"\u003E\u914d\u7f6e\u4ecb\u7ecd\u003C/a\u003E\u003C/li\u003E\n\u003Cli\u003E \u003Ca href=\"4.generator\" class=\"md_relative_url\"\u003E\u4ee3\u7801\u751f\u6210\u5668\u003C/a\u003E\u003C/li\u003E\n\u003Cli\u003E \u003Ca href=\"5.extend\" class=\"md_relative_url\"\u003E\u6269\u5c55\u901a\u7528\u63a5\u53e3\u003C/a\u003E\u003C/li\u003E\n\u003Cli\u003E \u003Ca href=\"6.example\" class=\"md_relative_url\"\u003EExample \u7528\u6cd5\u003C/a\u003E\u003C/li\u003E\n\u003Cli\u003E \u5176\u4ed6\u914d\u7f6e\u548c\u7528\u6cd5\n\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u003Ca href=\"7.1.cache\" class=\"md_relative_url\"\u003E7.1 \u4e8c\u7ea7\u7f13\u5b58\u914d\u7f6e\u003C/a\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\"7.2.typehandler\" class=\"md_relative_url\"\u003E7.2 TypeHandler \u7528\u6cd5\u003C/a\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003C/li\u003E\n\u003Cli\u003E \u003Ca href=\"faq\" class=\"md_relative_url\"\u003E\u5e38\u89c1\u95ee\u9898\u003C/a\u003E\u003C/li\u003E\n\u003Cli\u003E \u003Ca href=\"changelog\" class=\"md_relative_url\"\u003E\u66f4\u65b0\u65e5\u5fd7\u003C/a\u003E\u003C/li\u003E\n\u003C/ol\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"\u6350\u8d60_1\" href=\"#\u6350\u8d60_1\"\u003E\u003C/a\u003E\u6350\u8d60\u003C/h2\u003E\n\u003Cp\u003E\u9879\u76ee\u7684\u53d1\u5c55\u79bb\u4e0d\u5f00\u4f60\u7684\u652f\u6301\uff0c\u8bf7\u4f5c\u8005\u559d\u676f\u5496\u5561\u5427\uff01\u003C/p\u003E\n\n\u003Cp\u003E\u652f\u4ed8\u5b9d\u003C/p\u003E\n\n\u003Cp\u003E\u003Cimg alt=\"\u652f\u4ed8\u5b9d\" src=\"http://mybatis.tk/images/alipay.png\" /\u003E\u003C/p\u003E\n\n\u003Cp\u003E\u5fae\u4fe1\u003C/p\u003E\n\n\u003Cp\u003E\u003Cimg alt=\"\u5fae\u4fe1\" src=\"http://mybatis.tk/images/weixinpay.png\" /\u003E\u003C/p\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"\u60f3\u8981\u83b7\u53d6\u8be5\u9879\u76ee\u6700\u65b0\u6d88\u606f-\u53ef\u4ee5\u5173\u6ce8\u4e0b\u65b9\u516c\u4f17\u53f7_1\" href=\"#\u60f3\u8981\u83b7\u53d6\u8be5\u9879\u76ee\u6700\u65b0\u6d88\u606f-\u53ef\u4ee5\u5173\u6ce8\u4e0b\u65b9\u516c\u4f17\u53f7_1\"\u003E\u003C/a\u003E\u60f3\u8981\u83b7\u53d6\u8be5\u9879\u76ee\u6700\u65b0\u6d88\u606f\uff0c\u53ef\u4ee5\u5173\u6ce8\u4e0b\u65b9\u516c\u4f17\u53f7\u003C/h2\u003E\n\u003Cp\u003E\u003Cimg alt=\"\u5fae\u4fe1\u516c\u4f17\u53f7\" src=\"http://mybatis.tk/images/wxgzh.jpg\" /\u003E\u003C/p\u003E\n","208216":"\u003Cp\u003E\u003Ca href=\"1.integration\" class=\"md_relative_url\"\u003E1. \u96c6\u6210\u901a\u7528 Mapper\u003C/a\u003E  ||  \u003Ca href=\"2.orm\" class=\"md_relative_url\"\u003E2. \u5bf9\u8c61\u5173\u7cfb\u6620\u5c04\u003C/a\u003E  ||  \u003Ca href=\"3.config\" class=\"md_relative_url\"\u003E3. \u914d\u7f6e\u4ecb\u7ecd\u003C/a\u003E\u003C/p\u003E\n","208217":"\u003Col class=\"task-list\"\u003E\n\u003Cli\u003E \u003Ca href=\"1.integration\" class=\"md_relative_url\"\u003E\u96c6\u6210\u901a\u7528 Mapper\u003C/a\u003E\n\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E \u003Ca href=\"1.1-java\" class=\"md_relative_url\"\u003E1.1 Java \u7f16\u7801\u65b9\u5f0f\u003C/a\u003E\u003C/li\u003E\n\u003Cli\u003E \u003Ca href=\"1.2-spring\" class=\"md_relative_url\"\u003E1.2 \u548c Spring \u96c6\u6210\u003C/a\u003E\u003C/li\u003E\n\u003Cli\u003E \u003Ca href=\"1.3-spring-boot\" class=\"md_relative_url\"\u003E1.3 \u548c Spring Boot \u96c6\u6210\u003C/a\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003C/li\u003E\n\u003Cli\u003E \u003Ca href=\"2.orm\" class=\"md_relative_url\"\u003E\u5bf9\u8c61\u5173\u7cfb\u6620\u5c04\u003C/a\u003E\n\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E \u003Ca href=\"2.1-simple\" class=\"md_relative_url\"\u003E2.1 \u7b80\u5355\u793a\u4f8b\u003C/a\u003E\u003C/li\u003E\n\u003Cli\u003E \u003Ca href=\"2.2-mapping\" class=\"md_relative_url\"\u003E2.2 \u6570\u636e\u5e93\u6620\u5c04\u003C/a\u003E\u003C/li\u003E\n\u003Cli\u003E \u003Ca href=\"2.3-generatedvalue\" class=\"md_relative_url\"\u003E2.3 \u4e3b\u952e\u7b56\u7565\u003C/a\u003E\u003C/li\u003E\n\u003Cli\u003E \u003Ca href=\"2.4-version\" class=\"md_relative_url\"\u003E2.4 \u4e50\u89c2\u9501\u003C/a\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003C/li\u003E\n\u003Cli\u003E \u003Ca href=\"3.config\" class=\"md_relative_url\"\u003E\u914d\u7f6e\u4ecb\u7ecd\u003C/a\u003E\u003C/li\u003E\n\u003Cli\u003E \u003Ca href=\"4.generator\" class=\"md_relative_url\"\u003E\u4ee3\u7801\u751f\u6210\u5668\u003C/a\u003E\u003C/li\u003E\n\u003Cli\u003E \u003Ca href=\"5.extend\" class=\"md_relative_url\"\u003E\u6269\u5c55\u901a\u7528\u63a5\u53e3\u003C/a\u003E\u003C/li\u003E\n\u003Cli\u003E \u003Ca href=\"6.example\" class=\"md_relative_url\"\u003EExample \u7528\u6cd5\u003C/a\u003E\u003C/li\u003E\n\u003Cli\u003E \u5176\u4ed6\u914d\u7f6e\u548c\u7528\u6cd5\n\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u003Ca href=\"7.1.cache\" class=\"md_relative_url\"\u003E7.1 \u4e8c\u7ea7\u7f13\u5b58\u914d\u7f6e\u003C/a\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\"7.2.typehandler\" class=\"md_relative_url\"\u003E7.2 TypeHandler \u7528\u6cd5\u003C/a\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003C/li\u003E\n\u003Cli\u003E \u003Ca href=\"faq\" class=\"md_relative_url\"\u003E\u5e38\u89c1\u95ee\u9898\u003C/a\u003E\u003C/li\u003E\n\u003Cli\u003E \u003Ca href=\"changelog\" class=\"md_relative_url\"\u003E\u66f4\u65b0\u65e5\u5fd7\u003C/a\u003E\u003C/li\u003E\n\u003C/ol\u003E\n","219372":"\u003Ch1\u003E\u003Ca class=\"anchor\" id=\"\u66f4\u65b0\u65e5\u5fd7_1\" href=\"#\u66f4\u65b0\u65e5\u5fd7_1\"\u003E\u003C/a\u003E\u66f4\u65b0\u65e5\u5fd7\u003C/h1\u003E\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"3-5-2-2018-01-24_1\" href=\"#3-5-2-2018-01-24_1\"\u003E\u003C/a\u003E3.5.2 - 2018-01-24\u003C/h2\u003E\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"1-delete-\u548c-deletebyprimarykey-\u589e\u52a0\u5bf9\u4e50\u89c2\u9501\u6ce8\u89e3-version-\u7684\u652f\u6301-_1\" href=\"#1-delete-\u548c-deletebyprimarykey-\u589e\u52a0\u5bf9\u4e50\u89c2\u9501\u6ce8\u89e3-version-\u7684\u652f\u6301-_1\"\u003E\u003C/a\u003E1. \u003Ccode\u003Edelete\u003C/code\u003E \u548c \u003Ccode\u003EdeleteByPrimaryKey\u003C/code\u003E \u589e\u52a0\u5bf9\u4e50\u89c2\u9501\u6ce8\u89e3 \u003Ccode\u003E@Version\u003C/code\u003E \u7684\u652f\u6301\u3002\u003C/h4\u003E\n\u003Cp\u003E\u6d4b\u8bd5\u7528\u4f8b\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"cm\"\u003E/**\n * \u4e50\u89c2\u9501\u5220\u9664\n */\u003C/span\u003E\n\u003Cspan class=\"nd\"\u003E@Test\u003C/span\u003E\n\u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kt\"\u003Evoid\u003C/span\u003E \u003Cspan class=\"nf\"\u003EtestDeleteByPrimaryKeyAndVersion\u003C/span\u003E\u003Cspan class=\"o\"\u003E()\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n    \u003Cspan class=\"n\"\u003ESqlSession\u003C/span\u003E \u003Cspan class=\"n\"\u003EsqlSession\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003EMybatisHelper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EgetSqlSession\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n    \u003Cspan class=\"k\"\u003Etry\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003ECountryVersionMapper\u003C/span\u003E \u003Cspan class=\"n\"\u003Emapper\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003EsqlSession\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EgetMapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountryVersionMapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eclass\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n        \u003Cspan class=\"c1\"\u003E//\u6839\u636e\u4e3b\u952e\u5220\u9664\uff0c\u6ca1\u6709\u6307\u5b9a\u7248\u672c\u65f6\u5220\u9664\u4e0d\u4e86\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003EAssert\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EassertEquals\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"mi\"\u003E0\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E \u003Cspan class=\"n\"\u003Emapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EdeleteByPrimaryKey\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"mi\"\u003E100\u003C/span\u003E\u003Cspan class=\"o\"\u003E));\u003C/span\u003E\n\n        \u003Cspan class=\"n\"\u003ECountryVersion\u003C/span\u003E \u003Cspan class=\"n\"\u003EcountryVersion\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"k\"\u003Enew\u003C/span\u003E \u003Cspan class=\"n\"\u003ECountryVersion\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003EcountryVersion\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EsetId\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"mi\"\u003E100\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003EcountryVersion\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EsetVersion\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"mi\"\u003E2\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n        \u003Cspan class=\"c1\"\u003E//\u7248\u672c\u4e0d\u5bf9\u7684\u65f6\u5019\u7684\u65f6\u5019\u5220\u9664\u4e0d\u4e86\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003EAssert\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EassertEquals\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"mi\"\u003E0\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E \u003Cspan class=\"n\"\u003Emapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EdeleteByPrimaryKey\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EcountryVersion\u003C/span\u003E\u003Cspan class=\"o\"\u003E));\u003C/span\u003E\n\n        \u003Cspan class=\"n\"\u003EcountryVersion\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EsetId\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"mi\"\u003E100\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003EcountryVersion\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EsetVersion\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"mi\"\u003E1\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n        \u003Cspan class=\"c1\"\u003E//\u7248\u672c\u6b63\u786e\u7684\u65f6\u5019\u53ef\u4ee5\u771f\u6b63\u5220\u9664\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003EAssert\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EassertEquals\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"mi\"\u003E1\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E \u003Cspan class=\"n\"\u003Emapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EdeleteByPrimaryKey\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EcountryVersion\u003C/span\u003E\u003Cspan class=\"o\"\u003E));\u003C/span\u003E\n    \u003Cspan class=\"o\"\u003E}\u003C/span\u003E \u003Cspan class=\"k\"\u003Efinally\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003EsqlSession\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Erollback\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003EsqlSession\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eclose\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n    \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u65e5\u5fd7\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003EDEBUG [main] - ==\u0026gt;  Preparing: DELETE FROM country WHERE id = ? AND version = ? \nDEBUG [main] - ==\u0026gt; Parameters: 100(Integer), 100(Integer)\nDEBUG [main] - \u0026lt;==    Updates: 0\nDEBUG [main] - ==\u0026gt;  Preparing: DELETE FROM country WHERE id = ? AND version = ? \nDEBUG [main] - ==\u0026gt; Parameters: 100(Integer), 2(Integer)\nDEBUG [main] - \u0026lt;==    Updates: 0\nDEBUG [main] - ==\u0026gt;  Preparing: DELETE FROM country WHERE id = ? AND version = ? \nDEBUG [main] - ==\u0026gt; Parameters: 100(Integer), 1(Integer)\nDEBUG [main] - \u0026lt;==    Updates: 1\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u003Cstrong\u003E\u7279\u522b\u6ce8\u610f\uff1a\u003C/strong\u003E \u4e0a\u9762\u6d4b\u8bd5\u7528\u4f8b\u5df2\u7ecf\u5c55\u793a\u4e86\u589e\u52a0\u4e50\u89c2\u9501\u540e\u7684\u53c2\u6570\u5982\u4f55\u4f20\u9012\uff0c\u5f53\u4e3b\u952e\u591a\u4e2a\u503c\u6216\u8005\u4f7f\u7528\u4e50\u89c2\u9501\u7684\u65f6\u5019\u5c31\u9700\u8981\u901a\u8fc7\u5b9e\u4f53\uff08Map\u4e5f\u53ef\u4ee5\uff09\u4f20\u9012\u591a\u4e2a\u53c2\u6570\u503c\u3002\u548c\u4e4b\u524d\u7684 update \u4e00\u6837\uff0c\u9700\u8981\u81ea\u5df1\u5bf9\u6267\u884c\u7ed3\u679c\u8fdb\u884c\u5224\u65ad\u6765\u5224\u65ad\u662f\u5426\u6267\u884c\u6210\u529f\u3002\u003C/p\u003E\n\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"2-3-5-0-\u7248\u672c\u4e2d\u7684\u53c2\u6570-annotationassimpletype-\u540d\u5b57\u9519\u4e86-\u73b0\u5728\u6539\u4e3a-enumassimpletype-\u7528\u4e8e\u914d\u7f6e\u662f\u5426\u5c06\u679a\u4e3e\u7c7b\u578b\u5f53\u6210\u57fa\u672c\u7c7b\u578b\u5bf9\u5f85-_1\" href=\"#2-3-5-0-\u7248\u672c\u4e2d\u7684\u53c2\u6570-annotationassimpletype-\u540d\u5b57\u9519\u4e86-\u73b0\u5728\u6539\u4e3a-enumassimpletype-\u7528\u4e8e\u914d\u7f6e\u662f\u5426\u5c06\u679a\u4e3e\u7c7b\u578b\u5f53\u6210\u57fa\u672c\u7c7b\u578b\u5bf9\u5f85-_1\"\u003E\u003C/a\u003E2. 3.5.0 \u7248\u672c\u4e2d\u7684\u53c2\u6570 \u003Ccode\u003EannotationAsSimpleType\u003C/code\u003E \u540d\u5b57\u9519\u4e86\uff0c\u73b0\u5728\u6539\u4e3a \u003Ccode\u003EenumAsSimpleType\u003C/code\u003E\uff0c\u7528\u4e8e\u914d\u7f6e\u662f\u5426\u5c06\u679a\u4e3e\u7c7b\u578b\u5f53\u6210\u57fa\u672c\u7c7b\u578b\u5bf9\u5f85\u3002\u003C/h4\u003E\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"3-simpletypeutil-\u589e\u52a0\u5bf9-java8-\u4e2d\u7684\u65e5\u671f\u7c7b\u578b\u7684\u652f\u6301-_1\" href=\"#3-simpletypeutil-\u589e\u52a0\u5bf9-java8-\u4e2d\u7684\u65e5\u671f\u7c7b\u578b\u7684\u652f\u6301-_1\"\u003E\u003C/a\u003E3. \u003Ccode\u003ESimpleTypeUtil\u003C/code\u003E \u589e\u52a0\u5bf9 java8 \u4e2d\u7684\u65e5\u671f\u7c7b\u578b\u7684\u652f\u6301\u3002\u003C/h4\u003E\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"4-example-builder-\u589e\u52a0\u7c7b\u4f3c-weekend-\u4e2d-java8-\u65b9\u6cd5\u5f15\u7528\u7684\u7528\u6cd5-\u8be5\u529f\u80fd\u7531-chinaerserver-\u63d0\u4ea4-pr207-_1\" href=\"#4-example-builder-\u589e\u52a0\u7c7b\u4f3c-weekend-\u4e2d-java8-\u65b9\u6cd5\u5f15\u7528\u7684\u7528\u6cd5-\u8be5\u529f\u80fd\u7531-chinaerserver-\u63d0\u4ea4-pr207-_1\"\u003E\u003C/a\u003E4. \u003Ccode\u003EExample.Builder\u003C/code\u003E \u589e\u52a0\u7c7b\u4f3c \u003Ccode\u003EWeekend\u003C/code\u003E \u4e2d Java8 \u65b9\u6cd5\u5f15\u7528\u7684\u7528\u6cd5\uff0c\u8be5\u529f\u80fd\u7531 \u003Ca href=\"https://github.com/chinaerserver\"\u003Echinaerserver\u003C/a\u003E \u63d0\u4ea4(\u003Ca href=\"https://github.com/abel533/Mapper/pull/207\"\u003E#pr207\u003C/a\u003E)\u003C/h4\u003E\n\u003Cp\u003E\u793a\u4f8b\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nd\"\u003E@Test\u003C/span\u003E\n\u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kt\"\u003Evoid\u003C/span\u003E \u003Cspan class=\"nf\"\u003EtestWeekend\u003C/span\u003E\u003Cspan class=\"o\"\u003E()\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n    \u003Cspan class=\"n\"\u003ESqlSession\u003C/span\u003E \u003Cspan class=\"n\"\u003EsqlSession\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003EMybatisHelper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EgetSqlSession\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n    \u003Cspan class=\"k\"\u003Etry\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003ECountryMapper\u003C/span\u003E \u003Cspan class=\"n\"\u003Emapper\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003EsqlSession\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EgetMapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountryMapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eclass\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n        \u003Cspan class=\"c1\"\u003E//\u666e\u901a\u65b9\u5f0f\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003EList\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"n\"\u003EselectByExample\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003Emapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EselectByExample\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\n                \u003Cspan class=\"k\"\u003Enew\u003C/span\u003E \u003Cspan class=\"n\"\u003EExample\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EBuilder\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eclass\u003C/span\u003E\u003Cspan class=\"o\"\u003E).\u003C/span\u003E\u003Cspan class=\"na\"\u003Ewhere\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003ESqls\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Ecustom\u003C/span\u003E\u003Cspan class=\"o\"\u003E().\u003C/span\u003E\u003Cspan class=\"na\"\u003EandLike\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"countryname\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E \u003Cspan class=\"s\"\u003E\"China\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E)).\u003C/span\u003E\u003Cspan class=\"na\"\u003Ebuild\u003C/span\u003E\u003Cspan class=\"o\"\u003E());\u003C/span\u003E\n        \u003Cspan class=\"c1\"\u003E//Java8 \u65b9\u5f0f\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003EList\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"n\"\u003EselectByWeekendSql\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003Emapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EselectByExample\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"k\"\u003Enew\u003C/span\u003E \u003Cspan class=\"n\"\u003EExample\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EBuilder\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eclass\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n                \u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Ewhere\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EWeekendSqls\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E\u003Cspan class=\"n\"\u003Ecustom\u003C/span\u003E\u003Cspan class=\"o\"\u003E().\u003C/span\u003E\u003Cspan class=\"na\"\u003EandLike\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"nl\"\u003ECountry:\u003C/span\u003E\u003Cspan class=\"o\"\u003E:\u003C/span\u003E\u003Cspan class=\"n\"\u003EgetCountryname\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E \u003Cspan class=\"s\"\u003E\"China\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E)).\u003C/span\u003E\u003Cspan class=\"na\"\u003Ebuild\u003C/span\u003E\u003Cspan class=\"o\"\u003E());\u003C/span\u003E\n        \u003Cspan class=\"c1\"\u003E// \u5224\u65ad\u4e24\u4e2a\u7ed3\u679c\u6570\u7ec4\u5185\u5bb9\u662f\u5426\u76f8\u540c\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003EAssert\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EassertArrayEquals\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EselectByExample\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EtoArray\u003C/span\u003E\u003Cspan class=\"o\"\u003E(),\u003C/span\u003E \u003Cspan class=\"n\"\u003EselectByWeekendSql\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EtoArray\u003C/span\u003E\u003Cspan class=\"o\"\u003E());\u003C/span\u003E\n    \u003Cspan class=\"o\"\u003E}\u003C/span\u003E \u003Cspan class=\"k\"\u003Efinally\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003EsqlSession\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eclose\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n    \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"5-\u5f53\u9879\u76ee\u4e2d\u4f7f\u7528\u4e86\u81ea\u5b9a\u4e49classloader\u7684\u65f6\u5019-\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6eclassloader\u4e0a\u4e0b\u6587\u7684\u65b9\u5f0f\u6765\u4f7f\u5f97\u81ea\u5df1\u7684mapper-class\u80fd\u591f\u88ab\u627e\u5230-\u8fd9\u91cc\u7684\u4fee\u6539\u53c2\u7167\u4e86-mybatis-\u6e90\u7801\u4e2d\u7684-classloaderwrapper-\u7c7b-by-liyongjun1-pr185_1\" href=\"#5-\u5f53\u9879\u76ee\u4e2d\u4f7f\u7528\u4e86\u81ea\u5b9a\u4e49classloader\u7684\u65f6\u5019-\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6eclassloader\u4e0a\u4e0b\u6587\u7684\u65b9\u5f0f\u6765\u4f7f\u5f97\u81ea\u5df1\u7684mapper-class\u80fd\u591f\u88ab\u627e\u5230-\u8fd9\u91cc\u7684\u4fee\u6539\u53c2\u7167\u4e86-mybatis-\u6e90\u7801\u4e2d\u7684-classloaderwrapper-\u7c7b-by-liyongjun1-pr185_1\"\u003E\u003C/a\u003E5. \u5f53\u9879\u76ee\u4e2d\u4f7f\u7528\u4e86\u81ea\u5b9a\u4e49classloader\u7684\u65f6\u5019\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6eclassloader\u4e0a\u4e0b\u6587\u7684\u65b9\u5f0f\u6765\u4f7f\u5f97\u81ea\u5df1\u7684mapper class\u80fd\u591f\u88ab\u627e\u5230(\u8fd9\u91cc\u7684\u4fee\u6539\u53c2\u7167\u4e86 mybatis \u6e90\u7801\u4e2d\u7684 ClassLoaderWrapper \u7c7b)\uff0cby \u003Ca href=\"https://github.com/liyongjun1\"\u003Eliyongjun1\u003C/a\u003E \u003Ca href=\"https://github.com/abel533/Mapper/pull/185\"\u003E#pr185\u003C/a\u003E\u003C/h4\u003E\u003Ch4\u003E\u003Ca class=\"anchor\" id=\"6-\u91cd\u70b9\u63d0\u9192-3-5-0-\u4e2d-usesimpletype-\u9ed8\u8ba4\u503c\u6539\u4e3a-true-\u9ed8\u8ba4\u5ffd\u7565\u590d\u6742\u7c7b\u578b\u7684\u5b57\u6bb5-\u590d\u6742\u7c7b\u578b\u4e0d\u9700\u8981\u52a0-transient-\u6ce8\u89e3-\u5177\u4f53\u7c7b\u578b\u53ef\u4ee5\u53c2\u8003-simpletypeutil-\u7c7b-_1\" href=\"#6-\u91cd\u70b9\u63d0\u9192-3-5-0-\u4e2d-usesimpletype-\u9ed8\u8ba4\u503c\u6539\u4e3a-true-\u9ed8\u8ba4\u5ffd\u7565\u590d\u6742\u7c7b\u578b\u7684\u5b57\u6bb5-\u590d\u6742\u7c7b\u578b\u4e0d\u9700\u8981\u52a0-transient-\u6ce8\u89e3-\u5177\u4f53\u7c7b\u578b\u53ef\u4ee5\u53c2\u8003-simpletypeutil-\u7c7b-_1\"\u003E\u003C/a\u003E6. \u91cd\u70b9\u63d0\u9192\uff0c3.5.0 \u4e2d \u003Ccode\u003EuseSimpleType\u003C/code\u003E \u9ed8\u8ba4\u503c\u6539\u4e3a \u003Ccode\u003Etrue\u003C/code\u003E\uff0c\u9ed8\u8ba4\u5ffd\u7565\u590d\u6742\u7c7b\u578b\u7684\u5b57\u6bb5\uff0c\u590d\u6742\u7c7b\u578b\u4e0d\u9700\u8981\u52a0 \u003Ccode\u003E@Transient\u003C/code\u003E \u6ce8\u89e3\uff0c\u5177\u4f53\u7c7b\u578b\u53ef\u4ee5\u53c2\u8003 \u003Ccode\u003ESimpleTypeUtil\u003C/code\u003E \u7c7b\u3002\u003C/h4\u003E\n\u003Cp\u003E\u5728 \u003Ccode\u003ESimpleTypeUtil\u003C/code\u003E \u7c7b\u4e2d\uff0c\u7531\u4e8e\u4e00\u822c\u7684 JavaBean \uff08\u5c24\u5176\u662f MyBatis\uff09\u89c4\u8303\u4e2d\uff0c\u4e0d\u80fd\u4f7f\u7528\u57fa\u672c\u7c7b\u578b\uff0c\u8fd9\u4e3b\u8981\u662f\u7531\u4e8e\u57fa\u672c\u7c7b\u578b\u6709\u9ed8\u8ba4\u503c\uff0c\u5728\u4e00\u4e9b\u52a8\u6001 SQL \u60c5\u51b5\u4e0b\uff08\u5982\u6240\u6709 Selective \u65b9\u6cd5\uff09\uff0c\u65e0\u6cd5\u5224\u65ad\u57fa\u672c\u7c7b\u578b\u7684\u503c\u662f\u4e0d\u662f \u003Ccode\u003Enull\u003C/code\u003E\u3002\n\u6240\u4ee5\u5728\u8fd9\u91cc\u7684\u7b80\u5355\u7c7b\u578b\u662f\u4e0d\u5305\u542b \u003Ccode\u003Ebyte,short,int,long,float,double,char,boolean\u003C/code\u003E \u8fd9\u516b\u79cd\u57fa\u672c\u7c7b\u578b\u7684\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u5982\u679c\u4f60\u8981\u5347\u7ea7\u901a\u7528 Mapper \u4f46\u662f\u4e0d\u60f3\u4fee\u6539\u539f\u6765\u7684\u57fa\u672c\u7c7b\u578b\uff0c\u5c31\u8bbe\u7f6e \u003Ccode\u003EuseSimpleType=false\u003C/code\u003E\u3002\u003C/p\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"3-5-0-2018-01-08_1\" href=\"#3-5-0-2018-01-08_1\"\u003E\u003C/a\u003E3.5.0 - 2018-01-08\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u517c\u5bb9 mbg 1.3.6 \u7248\u672c\u3002\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EEntityColumn\u003C/code\u003E \u8bb0\u5f55 \u003Ccode\u003EEntityField\u003C/code\u003E \u4fe1\u606f\uff0c\u65b9\u4fbf\u540e\u7eed\u6269\u5c55\u4f7f\u7528\u3002\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003E\u9488\u5bf9 update \u4e24\u4e2a\u57fa\u672c\u65b9\u6cd5\u589e\u52a0\u4e50\u89c2\u9501\u529f\u80fd\uff0c\u5728\u5b9e\u4f53\u7c7b\u5bf9\u7248\u672c\u5b57\u6bb5\u589e\u52a0 \u003Ccode\u003E@Version\u003C/code\u003E \u6ce8\u89e3\u5373\u53ef\uff0c\u9ed8\u8ba4\u652f\u6301 \u003Ccode\u003EInteger\u003C/code\u003E \u548c \u003Ccode\u003ELong\u003C/code\u003E \u7c7b\u578b\uff0c\u5176\u4ed6\u60c5\u51b5\u53ef\u4ee5\u5b9e\u73b0 \u003Ccode\u003ENextVersion\u003C/code\u003E \u63a5\u53e3\u5e76\u5728\u6ce8\u89e3\u4e2d\u6307\u5b9a\u8be5\u5b9e\u73b0\uff0c\u4e00\u4e2a\u5b9e\u4f53\u7c7b\u4e2d\u6700\u591a\u53ea\u80fd\u6709\u4e00\u4e2a\u52a0 \u003Ccode\u003E@Version\u003C/code\u003E \u6ce8\u89e3\u7684\u5b57\u6bb5\u3002\u003C/p\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003E3.4.0\u589e\u52a0\u7684 \u003Ccode\u003EuseSimpleType\u003C/code\u003E \u9ed8\u8ba4\u503c\u6539\u4e3a \u003Ccode\u003Etrue\u003C/code\u003E\uff0c\u9ed8\u8ba4\u5ffd\u7565\u590d\u6742\u7c7b\u578b\u7684\u5b57\u6bb5\uff0c\u590d\u6742\u7c7b\u578b\u4e0d\u9700\u8981\u52a0 \u003Ccode\u003E@Transient\u003C/code\u003E \u6ce8\u89e3\uff0c\u5177\u4f53\u7c7b\u578b\u53ef\u4ee5\u53c2\u8003 \u003Ccode\u003ESimpleTypeUtil\u003C/code\u003E \u7c7b\u3002\u003C/p\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003E\u65b0\u589e \u003Ccode\u003EannotationAsSimpleType\u003C/code\u003E \u53c2\u6570\uff0c\u9ed8\u8ba4 \u003Ccode\u003Efalse\u003C/code\u003E\uff0c\u8bbe\u7f6e\u4e3a \u003Ccode\u003Etrue\u003C/code\u003E \u540e\u4f1a\u628a\u679a\u4e3e\u4f5c\u4e3a\u7b80\u5355\u7c7b\u578b\u5bf9\u5f85\uff0c\u9700\u8981\u914d\u5408 \u003Ccode\u003EuseSimpleType = true\u003C/code\u003E \u4f7f\u7528\u3002\u003C/p\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003E\u65b0\u589e \u003Ccode\u003EwrapKeyword\u003C/code\u003E \u53c2\u6570\uff0c\u914d\u7f6e\u540e\u4f1a\u81ea\u52a8\u5904\u7406\u5173\u952e\u5b57\uff0c\u53ef\u4ee5\u914d\u7684\u503c\u548c\u6570\u636e\u5e93\u6709\u5173\uff0c\u4f8b\u5982 sqlserver \u53ef\u4ee5\u914d\u7f6e\u4e3a \u003Ccode\u003E[{0}]\u003C/code\u003E\uff0c\u4f7f\u7528 \u003Ccode\u003E{0}\u003C/code\u003E \u66ff\u4ee3\u539f\u6765\u7684\u5217\u540d\u3002\u003C/p\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003E\u003Ccode\u003EFieldHelper\u003C/code\u003E \u6539\u4e3a\u5224\u65ad\u5f53\u524djdk\u7248\u672c\u662f\u5426\u4e3a6\u548c7\uff0c\u5176\u4ed6\u60c5\u51b5\u6309jdk8\u5904\u7406\uff0c\u56e0\u6b64\u652f\u6301jdk9+\u003C/p\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003E\u65b0\u589e \u003Ccode\u003EselectOneByExample\u003C/code\u003E \u65b9\u6cd5\uff0c\u5fc5\u987b\u4fdd\u8bc1\u8fd4\u56de\u503c\u6700\u591a 1 \u4e2a\uff0c\u5426\u5219\u629b\u51fa\u5f02\u5e38\u3002\u003C/p\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003E\u589e\u52a0\u65b0\u7684 \u003Ccode\u003Etk.mybatis.mapper.additional.insert.InsertListMapper\u003C/code\u003E\uff0c\u8fd9\u4e2a\u6279\u91cf\u63d2\u5165\u65b9\u6cd5\u4e0d\u652f\u6301\u4e3b\u952e\u7b56\u7565\uff0c\u4e0d\u4f1a\u8fd4\u56de\u81ea\u52a8\u751f\u6210\u7684\u4e3b\u952e\u003C/p\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\n\u003Cp\u003E\u4f7f\u7528 \u003Ccode\u003E@Version\u003C/code\u003E \u6ce8\u89e3\u7684\u6548\u679c\u5982\u4e0b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"n\"\u003EDEBUG\u003C/span\u003E \u003Cspan class=\"p\"\u003E[\u003C/span\u003E\u003Cspan class=\"n\"\u003Emain\u003C/span\u003E\u003Cspan class=\"p\"\u003E]\u003C/span\u003E \u003Cspan class=\"o\"\u003E-\u003C/span\u003E \u003Cspan class=\"o\"\u003E==\u0026gt;\u003C/span\u003E  \u003Cspan class=\"n\"\u003EPreparing\u003C/span\u003E\u003Cspan class=\"p\"\u003E:\u003C/span\u003E \u003Cspan class=\"k\"\u003EUPDATE\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountry\u003C/span\u003E \u003Cspan class=\"k\"\u003ESET\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountryname\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"o\"\u003E?\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E\u003Cspan class=\"n\"\u003Ecountrycode\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"o\"\u003E?\u003C/span\u003E\u003Cspan class=\"p\"\u003E,\u003C/span\u003E\u003Cspan class=\"k\"\u003Eversion\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"mi\"\u003E2\u003C/span\u003E \u003Cspan class=\"k\"\u003EWHERE\u003C/span\u003E \u003Cspan class=\"n\"\u003Eid\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"o\"\u003E?\u003C/span\u003E \u003Cspan class=\"k\"\u003EAND\u003C/span\u003E \u003Cspan class=\"k\"\u003Eversion\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"o\"\u003E?\u003C/span\u003E \n\u003Cspan class=\"n\"\u003EDEBUG\u003C/span\u003E \u003Cspan class=\"p\"\u003E[\u003C/span\u003E\u003Cspan class=\"n\"\u003Emain\u003C/span\u003E\u003Cspan class=\"p\"\u003E]\u003C/span\u003E \u003Cspan class=\"o\"\u003E-\u003C/span\u003E \u003Cspan class=\"o\"\u003E==\u0026gt;\u003C/span\u003E \u003Cspan class=\"k\"\u003EParameters\u003C/span\u003E\u003Cspan class=\"p\"\u003E:\u003C/span\u003E \u003Cspan class=\"err\"\u003E\u7f8e\u56fd\u003C/span\u003E\u003Cspan class=\"mi\"\u003E2\u003C/span\u003E\u003Cspan class=\"p\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EString\u003C/span\u003E\u003Cspan class=\"p\"\u003E),\u003C/span\u003E \u003Cspan class=\"n\"\u003EUS\u003C/span\u003E\u003Cspan class=\"p\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EString\u003C/span\u003E\u003Cspan class=\"p\"\u003E),\u003C/span\u003E \u003Cspan class=\"mi\"\u003E174\u003C/span\u003E\u003Cspan class=\"p\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EInteger\u003C/span\u003E\u003Cspan class=\"p\"\u003E),\u003C/span\u003E \u003Cspan class=\"mi\"\u003E1\u003C/span\u003E\u003Cspan class=\"p\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EInteger\u003C/span\u003E\u003Cspan class=\"p\"\u003E)\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u81ea\u52a8\u5904\u7406\u5173\u952e\u5b57\u4ee3\u7801\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"c1\"\u003E//\u81ea\u52a8\u5904\u7406\u5173\u952e\u5b57\u003C/span\u003E\n\u003Cspan class=\"k\"\u003Eif\u003C/span\u003E \u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EStringUtil\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EisNotEmpty\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EwrapKeyword\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E \u003Cspan class=\"o\"\u003E\u0026amp;\u0026amp;\u003C/span\u003E \u003Cspan class=\"n\"\u003ESqlReservedWords\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EcontainsWord\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EcolumnName\u003C/span\u003E\u003Cspan class=\"o\"\u003E))\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n    \u003Cspan class=\"n\"\u003EcolumnName\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003EMessageFormat\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eformat\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EwrapKeyword\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E \u003Cspan class=\"n\"\u003EcolumnName\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n\u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"3-4-6-2017-12-17_1\" href=\"#3-4-6-2017-12-17_1\"\u003E\u003C/a\u003E3.4.6 - 2017-12-17\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u003Ccode\u003EExample\u003C/code\u003E \u65b0\u589e builder \u6a21\u5f0f\uff08by \u003Ca href=\"https://github.com/abel533/Mapper/commits?author=Ngone51\"\u003ENgone51\u003C/a\u003E\uff09\u3002\u003C/li\u003E\n\u003Cli\u003E\u8bbe\u7f6e\u4e0b\u5212\u7ebf\u98ce\u683c\u66ff\u6362\u4e3a\u9a7c\u5cf0\u98ce\u683c\u7684Pattern\u4e3aStringUtil\u7684\u9759\u6001\u53d8\u91cf\uff08by \u003Ca href=\"https://github.com/abel533/Mapper/commits?author=Ngone51\"\u003ENgone51\u003C/a\u003E\uff09\u3002\u003C/li\u003E\n\u003C/ul\u003E\n\n\u003Cp\u003E\u4e00\u4e2a\u7b80\u5355\u7684 builder \u7528\u6cd5\u793a\u4f8b\uff1a\u003C/p\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"cm\"\u003E/*\n *   @description: \u591a\u4e2awhere\u8fde\u63a5\u7684\u67e5\u8be2\u8bed\u53e5\u6d4b\u8bd5\n *\n */\u003C/span\u003E\n\u003Cspan class=\"nd\"\u003E@Test\u003C/span\u003E\n\u003Cspan class=\"kd\"\u003Epublic\u003C/span\u003E \u003Cspan class=\"kt\"\u003Evoid\u003C/span\u003E \u003Cspan class=\"nf\"\u003EtestWhereAndWhereCompound\u003C/span\u003E\u003Cspan class=\"o\"\u003E()\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n    \u003Cspan class=\"n\"\u003ESqlSession\u003C/span\u003E \u003Cspan class=\"n\"\u003EsqlSession\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003EMybatisHelper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EgetSqlSession\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n    \u003Cspan class=\"k\"\u003Etry\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003ECountryMapper\u003C/span\u003E \u003Cspan class=\"n\"\u003Emapper\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003EsqlSession\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EgetMapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountryMapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eclass\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003EExample\u003C/span\u003E \u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003EExample\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Ebuilder\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eclass\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n                \u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Ewhere\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003ESqls\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Ecustom\u003C/span\u003E\u003Cspan class=\"o\"\u003E()\u003C/span\u003E\n                    \u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EandEqualTo\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"countryname\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E \u003Cspan class=\"s\"\u003E\"China\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n                    \u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EandEqualTo\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"id\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E \u003Cspan class=\"mi\"\u003E35\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n                \u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n                \u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EandWhere\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003ESqls\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Ecustom\u003C/span\u003E\u003Cspan class=\"o\"\u003E()\u003C/span\u003E\n                    \u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EandEqualTo\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"id\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E \u003Cspan class=\"mi\"\u003E183\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n                \u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n                \u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Ebuild\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003EList\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003ECountry\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountries\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003Emapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EselectByExample\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003Eexample\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003EAssert\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EassertEquals\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"mi\"\u003E0\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E \u003Cspan class=\"n\"\u003Ecountries\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Esize\u003C/span\u003E\u003Cspan class=\"o\"\u003E());\u003C/span\u003E\n\n    \u003Cspan class=\"o\"\u003E}\u003C/span\u003E \u003Cspan class=\"k\"\u003Efinally\u003C/span\u003E \u003Cspan class=\"o\"\u003E{\u003C/span\u003E\n        \u003Cspan class=\"n\"\u003EsqlSession\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eclose\u003C/span\u003E\u003Cspan class=\"o\"\u003E();\u003C/span\u003E\n    \u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003Cspan class=\"o\"\u003E}\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cp\u003E\u66f4\u591a\u7528\u6cd5\u53ef\u4ee5\u901a\u8fc7\u6d4b\u8bd5 \u003Ca href=\"https://github.com/abel533/Mapper/blob/master/src/test/java/tk/mybatis/mapper/test/example/TestExampleBuilder.java\"\u003E\u003Ccode\u003ETestExampleBuilder\u003C/code\u003E\u003C/a\u003E \u4e86\u89e3\u3002\u003C/p\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"3-4-5-2017-11-11_1\" href=\"#3-4-5-2017-11-11_1\"\u003E\u003C/a\u003E3.4.5 - 2017-11-11\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u63d2\u4ef6\u589e\u52a0\u4e00\u4e2a \u003Ccode\u003E\u0026lt;context\u0026gt;\u003C/code\u003E \u5c5e\u6027\u914d\u7f6e\uff0c\u53ef\u4ee5\u63a7\u5236\u662f\u5426\u4f7f\u7528\u901a\u7528 Mapper \u81ea\u5e26\u7684 \u003Ccode\u003EMapperCommentGenerator\u003C/code\u003E\uff0c\u7528\u6cd5\u5982\u4e0b\uff1a\n\u003Ccode\u003Exml\n\u0026lt;generatorConfiguration\u0026gt;\n\u0026lt;context id=\u0026quot;Mysql\u0026quot; targetRuntime=\u0026quot;MyBatis3Simple\u0026quot; defaultModelType=\u0026quot;flat\u0026quot;\u0026gt;\n\u0026lt;!--\u65b0\u589e\u7684\u53c2\u6570\uff0c\u9ed8\u8ba4true \u4f7f\u7528--\u0026gt;\n\u0026lt;property name=\u0026quot;useMapperCommentGenerator\u0026quot; value=\u0026quot;false\u0026quot;/\u0026gt;\n\u0026lt;!-- \u5176\u4ed6 --\u0026gt;\n\u0026lt;/context\u0026gt;\n\u0026lt;/generatorConfiguration\u0026gt;\n\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u589e\u52a0\u57fa\u4e8e MBG \u7684\u4ee3\u7801\u751f\u6210\u5668\u63d2\u4ef6\uff0c\u53c2\u8003\u003Ca href=\"https://github.com/abel533/Mapper/blob/master/wiki/mapper3/11.CodeGenerator.md\"\u003E\u4f7f\u7528\u6587\u6863\u003C/a\u003E\u3002\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"3-4-4-2017-10-19_1\" href=\"#3-4-4-2017-10-19_1\"\u003E\u003C/a\u003E3.4.4 - 2017-10-19\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u589e\u52a0 mapper-weekend\uff08\u4f5c\u8005 \u003Ca href=\"https://github.com/liuyuyu\"\u003Eliuyuyu\u003C/a\u003E\uff09\uff0c\u652f\u6301jdk8\u51fd\u6570\u5f0f\u5f15\u7528\u65b9\u6cd5\uff0c\u7528\u6cd5\u5982\u4e0b\uff1a\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E  \u003Cspan class=\"n\"\u003EUserMapper\u003C/span\u003E    \u003Cspan class=\"n\"\u003EuserMapper\u003C/span\u003E \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003EsqlSession\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EgetMapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EUserMapper\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eclass\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n  \u003Cspan class=\"n\"\u003EWeekend\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026lt;\u003C/span\u003E\u003Cspan class=\"n\"\u003EUser\u003C/span\u003E\u003Cspan class=\"o\"\u003E\u0026gt;\u003C/span\u003E \u003Cspan class=\"n\"\u003Eweekend\u003C/span\u003E    \u003Cspan class=\"o\"\u003E=\u003C/span\u003E \u003Cspan class=\"n\"\u003EWeekend\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eof\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"n\"\u003EUser\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003Eclass\u003C/span\u003E\u003Cspan class=\"o\"\u003E);\u003C/span\u003E\n  \u003Cspan class=\"n\"\u003Eweekend\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EweekendCriteria\u003C/span\u003E\u003Cspan class=\"o\"\u003E()\u003C/span\u003E\n          \u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EandIsNull\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"nl\"\u003EUser:\u003C/span\u003E\u003Cspan class=\"o\"\u003E:\u003C/span\u003E\u003Cspan class=\"n\"\u003EgetId\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n          \u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EandBetween\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"nl\"\u003EUser:\u003C/span\u003E\u003Cspan class=\"o\"\u003E:\u003C/span\u003E\u003Cspan class=\"n\"\u003EgetId\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E\u003Cspan class=\"mi\"\u003E0\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E\u003Cspan class=\"mi\"\u003E10\u003C/span\u003E\u003Cspan class=\"o\"\u003E)\u003C/span\u003E\n          \u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EandIn\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"nl\"\u003EUser:\u003C/span\u003E\u003Cspan class=\"o\"\u003E:\u003C/span\u003E\u003Cspan class=\"n\"\u003EgetUserName\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E \u003Cspan class=\"n\"\u003EArrays\u003C/span\u003E\u003Cspan class=\"o\"\u003E.\u003C/span\u003E\u003Cspan class=\"na\"\u003EasList\u003C/span\u003E\u003Cspan class=\"o\"\u003E(\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"a\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"b\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E,\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"c\"\u003C/span\u003E\u003Cspan class=\"o\"\u003E));\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cblockquote\u003E\n\u003Cp\u003E\u53ef\u4ee5\u5728 \u003Ccode\u003EExample.Criteria\u003C/code\u003E \u7684\u6761\u4ef6\u65b9\u6cd5\u91cc\u4f20 lambada(\u518d\u4e5f\u4e0d\u7528\u62c5\u5fc3\u6539\u6570\u636e\u5e93\u4e86......)\u3002\u003C/p\u003E\n\u003C/blockquote\u003E\n\n\u003Cp\u003E\u540e\u7eed\u4f1a\u7ee7\u7eed\u5728 3.x \u7248\u672c\u66f4\u65b0\u548c\u7ef4\u62a4\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u539f\u6765\u8ba1\u5212\u7684 4.0 \u7248\u672c\u6253\u7b97\u7528 mybatis \u66f4\u539f\u751f\u7684\u65b9\u5f0f\u5b9e\u73b0\uff0c\u6240\u4ee5\u9700\u8981\u5c3d\u5feb\u914d\u5408\u5b98\u65b9\u5408\u5e76\u4e00\u4e2a\u65b0\u529f\u80fd\uff0c\u53ea\u6709\u7b49\u5408\u5e76\u540e\u624d\u4f1a\u5f00\u59cb 4.0 \u7684\u5f00\u53d1\u3002\u003C/p\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"3-4-3-2017-08-17_1\" href=\"#3-4-3-2017-08-17_1\"\u003E\u003C/a\u003E3.4.3 - 2017-08-17\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u003Ccode\u003EMapperPlugin\u003C/code\u003E \u589e\u52a0 \u003Ccode\u003EforceAnnotation\u003C/code\u003E \u53c2\u6570\uff0c\u9ed8\u8ba4 \u003Ccode\u003Efalse\u003C/code\u003E\uff0c\u8bbe\u7f6e\u4e3a \u003Ccode\u003Etrue\u003C/code\u003E \u540e\u4e00\u5b9a\u4f1a\u751f\u6210\u003Ccode\u003E@Table\u003C/code\u003E\u548c\u003Ccode\u003E@Column\u003C/code\u003E\u6ce8\u89e3\u3002\u003C/li\u003E\n\u003Cli\u003E\u4e3a\u5b9e\u4f8b\u5316 \u003Ccode\u003ETypeHandler\u003C/code\u003E \u589e\u52a0 \u003Ccode\u003EjavaTypeClass\u003C/code\u003E by \u003Cstrong\u003Ejunchao\u003C/strong\u003E\u3002\u003C/li\u003E\n\u003Cli\u003E\u66f4\u65b0 \u003Ccode\u003EExample\u003C/code\u003E \u7c7b\uff0c\u5728\u83b7\u53d6 \u003Ccode\u003Eproperty\u003C/code\u003E \u65f6\uff0c\u5224\u65ad\u6709\u6ca1\u6709\u8be5 \u003Ccode\u003Eproperty\u003C/code\u003E \u5e76\u629b\u51fa\u5f02\u5e38 by \u003Cstrong\u003Echengcheng.feng\u003C/strong\u003E\u3002\u003C/li\u003E\n\u003Cli\u003E\u6240\u6709\u7c7b\u7684\u5c5e\u6027\u4ece \u003Ccode\u003EHashMap\u003C/code\u003E \u6539\u4e3a \u003Ccode\u003EConcurrentHashMap\u003C/code\u003E\u3002\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"3-4-2-2017-07-19_1\" href=\"#3-4-2-2017-07-19_1\"\u003E\u003C/a\u003E3.4.2 - 2017-07-19\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u7b80\u5316Example\u7684xml\u903b\u8f91\uff0c\u89e3\u51b3\u7531\u4e8eand,or\u4f4d\u7f6e\u9519\u8bef\u5bfc\u81f4Example\u4f7f\u7528\u7a7a\u6761\u4ef6\u65f6\u7684\u9519\u8bef\uff0c\u5b8c\u5584\u6d4b\u8bd5\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"3-4-1-2017-07-17_1\" href=\"#3-4-1-2017-07-17_1\"\u003E\u003C/a\u003E3.4.1 - 2017-07-17\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u003Ccode\u003EExample\u003C/code\u003E \u589e\u52a0\u590d\u6742\u7684 \u003Ccode\u003Eand\u003C/code\u003E \u548c \u003Ccode\u003Eor\u003C/code\u003E \u529f\u80fd\u3002\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EExample\u003C/code\u003E \u589e\u52a0\u6392\u9664\u67e5\u8be2\u5b57\u6bb5\u7684\u65b9\u6cd5 \u003Ccode\u003EexcludeProperties\u003C/code\u003E(\u003Ccode\u003EselectProperties\u003C/code\u003E\u4f18\u5148\u7ea7\u66f4\u9ad8) \u003Ca href=\"http://git.oschina.net/free/Mapper/issues/261\"\u003E\u003C/a\u003E\u003Ca href=\"/free/Mapper/issues/IDVJN\" class=\"gfm gfm-issue \" title=\"Issue: \u5efa\u8bae\u65b0\u589e\u5b57\u6bb5\u53cd\u9009\u8fc7\u6ee4\u529f\u80fd--\u5f90\u5fd7\u6469\"\u003E#261:\u5efa\u8bae\u65b0\u589e\u5b57\u6bb5\u53cd\u9009\u8fc7\u6ee4\u529f\u80fd--\u5f90\u5fd7\u6469\u003C/a\u003E\u003Ca href=\"http://git.oschina.net/free/Mapper/issues/261\"\u003E\u003C/a\u003E.\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003ESqlHelper\u003C/code\u003E \u4e2d\u590d\u6742\u7684 \u003Ccode\u003Eif\u003C/code\u003E \u6539\u4e3a \u003Ccode\u003Echoose\u003C/code\u003E \u65b9\u5f0f\u3002\u003C/li\u003E\n\u003Cli\u003E\u89e3\u51b3\u901a\u8fc7\u003Ccode\u003E@Column\u003C/code\u003E\u914d\u7f6e\u5173\u952e\u5b57\u7684\u5206\u9694\u7b26\u65f6\uff0c\u65e0\u6cd5\u5f97\u5230\u8be5\u5217\u503c\u7684bug\u3002\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"3-4-0-2017-02-19_1\" href=\"#3-4-0-2017-02-19_1\"\u003E\u003C/a\u003E3.4.0 - 2017-02-19\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u003Ccode\u003EExample\u003C/code\u003E \u589e\u52a0 for update \u652f\u6301\uff0c\u4ec5\u80fd\u7528\u4e8e selectByExample \u548c selectCountByExample \u65b9\u6cd5 \u003Ca href=\"/free/Mapper/issues/IBUXY\" class=\"gfm gfm-issue \" title=\"Issue: \u5efa\u8bae\u589e\u52a0for update-----\u5f90\u5fd7\u6469\"\u003E#210:\u5efa\u8bae\u589e\u52a0for update-----\u5f90\u5fd7\u6469\u003C/a\u003E\n\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EExample.Criteria\u003C/code\u003E \u589e\u52a0 \u003Ccode\u003EandAllEqualTo\u003C/code\u003E \u65b9\u6cd5\uff0c\u5c06\u6b64\u5bf9\u8c61\u7684\u6240\u6709\u5b57\u6bb5\u53c2\u6570\u4f5c\u4e3a\u76f8\u7b49\u67e5\u8be2\u6761\u4ef6\uff0c\u5982\u679c\u5b57\u6bb5\u4e3a null\uff0c\u5219\u4e3a is null \u003Ca href=\"/free/Mapper/issues/IBL1J\" class=\"gfm gfm-issue \" title=\"Issue: \u5efa\u8bae\u4f18\u5316\u5bf9Example\u64cd\u4f5c\u7c7b\u91cc\u9762\u7684Null\u7684sql\u62fc\u63a5\u3002\"\u003E#206:\u5efa\u8bae\u4f18\u5316\u5bf9Example\u64cd\u4f5c\u7c7b\u91cc\u9762\u7684Null\u7684sql\u62fc\u63a5\u3002\u003C/a\u003E\n\u003C/li\u003E\n\u003Cli\u003E\u589e\u52a0\u53c2\u6570 \u003Ccode\u003EcheckExampleEntityClass\u003C/code\u003E\uff0c\u9ed8\u8ba4 \u003Ccode\u003Efalse\u003C/code\u003E \u7528\u4e8e\u6821\u9a8c\u901a\u7528 Example \u6784\u9020\u53c2\u6570 entityClass \u662f\u5426\u548c\u5f53\u524d\u8c03\u7528\u7684 Mapper \u7c7b\u578b\u4e00\u81f4 \u003Ca href=\"/free/Mapper/issues/IBJFH\" class=\"gfm gfm-issue \" title=\"Issue: \u6821\u9a8cAExample\u7528\u4e8eBMapper\u65b9\u6cd5\u65f6\u629b\u51fa\u5f02\u5e38\"\u003E#201:\u6821\u9a8cAExample\u7528\u4e8eBMapper\u65b9\u6cd5\u65f6\u629b\u51fa\u5f02\u5e38\u003C/a\u003E\n\u003C/li\u003E\n\u003Cli\u003E\u589e\u52a0\u53c2\u6570 \u003Ccode\u003EuseSimpleType\u003C/code\u003E\uff0c\u9ed8\u8ba4 \u003Ccode\u003Efalse\u003C/code\u003E\uff0c\u542f\u7528\u540e\u5224\u65ad\u5b9e\u4f53\u7c7b\u5c5e\u6027\u662f\u5426\u4e3a\u8868\u5b57\u6bb5\u65f6\u6821\u9a8c\u5b57\u6bb5\u662f\u5426\u4e3a\u7b80\u5355\u7c7b\u578b\uff0c\u5982\u679c\u4e0d\u662f\u5c31\u5ffd\u7565\u8be5\u5c5e\u6027\uff0c\u8fd9\u4e2a\u914d\u7f6e\u4f18\u5148\u7ea7\u9ad8\u4e8e\u6240\u6709\u6ce8\u89e3\u003C/li\u003E\n\u003Cli\u003E\u589e\u52a0\u53c2\u6570 \u003Ccode\u003EsimpleTypes\u003C/code\u003E\uff0c\u9ed8\u8ba4\u7684\u7b80\u5355\u7c7b\u578b\u5728 \u003Ccode\u003ESimpleTypeUtil\u003C/code\u003E \u4e2d\uff0c\u4f7f\u7528\u8be5\u53c2\u6570\u53ef\u4ee5\u589e\u52a0\u989d\u5916\u7684\u7b80\u5355\u7c7b\u578b\uff0c\u901a\u8fc7\u9017\u53f7\u9694\u5f00\u7684\u5168\u9650\u5b9a\u7c7b\u540d\u6dfb\u52a0\u003C/li\u003E\n\u003Cli\u003E\u6240\u6709 \u003Ccode\u003ERuntimeException\u003C/code\u003E \u5f02\u5e38\u6539\u4e3a \u003Ccode\u003Etk.mybatis.mapper.MapperException\u003C/code\u003E \u5f02\u5e38\u003C/li\u003E\n\u003Cli\u003E\u6240\u6709 Update \u65b9\u6cd5\u6dfb\u52a0 \u003Ccode\u003E@Options(useCache = false, useGeneratedKeys = false)\u003C/code\u003E\uff0cfix \u003Ca href=\"/free/Mapper/issues/IBZZA\" class=\"gfm gfm-issue \" title=\"Issue: update\u5bf9\u8c61\u65f6\uff0c\u5bf9\u8c61\u7684\u4e3b\u952eID\u53d8\u4e3anull\"\u003E#216:update\u5bf9\u8c61\u65f6\uff0c\u5bf9\u8c61\u7684\u4e3b\u952eID\u53d8\u4e3anull\u003C/a\u003E\n\u003C/li\u003E\n\u003Cli\u003E\u4f7f\u7528\u81ea\u5b9a\u4e49\u7684 \u003Ccode\u003ESelectKeyGenerator\u003C/code\u003E\uff0c\u9632\u6b62\u6709\u9ed8\u8ba4\u503c\u65f6\u88ab\u66ff\u6362\u6389 fix \u003Ca href=\"/free/Mapper/issues/IBYHD\" class=\"gfm gfm-issue \" title=\"Issue: MySQL\u4f7f\u7528selectKey\u65f6\uff0c\u5982\u679c\u4e3b\u52a8\u7ed9\u4e3b\u952e\u8bbe\u503c\uff0c\u5219insert\u540e\uff0c\u539f\u6765\u7684\u4e3b\u952e\u503c\u4f1a\u88abselectKey\u51b2\u6389\"\u003E#213:MySQL\u4f7f\u7528selectKey\u65f6\uff0c\u5982\u679c\u4e3b\u52a8\u7ed9\u4e3b\u952e\u8bbe\u503c\uff0c\u5219insert\u540e\uff0c\u539f\u6765\u7684\u4e3b\u952e\u503c\u4f1a\u88abselectKey\u51b2\u6389\u003C/a\u003E\n\u003C/li\u003E\n\u003Cli\u003E\u5c06 MapperTemplate \u5c5e\u6027\u6539\u4e3a protected\u003C/li\u003E\n\u003Cli\u003EMBG \u63d2\u4ef6\u4e2d generatedKey \u5143\u7d20\u7684 sqlStatement \u5c5e\u6027\u53ef\u4ee5\u914d\u7f6e\u4e3a\u5f62\u5982 select SEQ_{1} from dual \u7684 SQL\uff0c\u5176\u4e2d {0} \u4ee3\u8868\u5c0f\u5199\u7684\u8868\u540d\uff0c{1} \u662f\u5927\u5199\u7684\u8868\u540d\nMBG \u914d\u7f6e\u793a\u4f8b\u5982\u4e0b,\u7c7b\u4f3c Oracle \u5e8f\u5217\u7684\u914d\u7f6e\u65b9\u5f0f\uff1a\n\u003Ccode\u003Exml\n\u0026lt;generatedKey column=\u0026quot;id\u0026quot; \n    sqlStatement=\u0026quot;select SEQ_{1}.nextval from dual\u0026quot; \n    identity=\u0026quot;false\u0026quot; \n    type=\u0026quot;pre\u0026quot;/\u0026gt;\n\u003C/code\u003E\n\u8fd9\u4e2a\u914d\u7f6e\u751f\u6210\u7684\u4ee3\u7801\u4f1a\u50cf\u4e0b\u9762\u8fd9\u6837\uff1a\n\u003Ccode\u003Ejava\npublic class Author {\n   @Id\n   @GeneratedValue(strategy = GenerationType.IDENTITY,\n           generator = \u0026quot;select SEQ_AUTHOR.nextval from dual\u0026quot;)\n   private Integer id;\n   // \u7701\u7565\u5176\u4ed6\n}\n\u003C/code\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"3-3-9-2016-09-04_1\" href=\"#3-3-9-2016-09-04_1\"\u003E\u003C/a\u003E3.3.9 - 2016-09-04\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u589e\u52a0\u003Ccode\u003EselectByIds\u003C/code\u003E\u548c\u003Ccode\u003EdeleteByIds\u003C/code\u003E\uff0c\u7528\u6cd5\u89c1\u901a\u7528Mapper\u63a5\u53e3\u5927\u5168\u003C/li\u003E\n\u003Cli\u003E\u6839\u636e\u003Cstrong\u003E\u674e\u9886\u5317\u003C/strong\u003E\u5efa\u8bae\u4fee\u6539\u003Ccode\u003EExample\u003C/code\u003E\u4e2d\u7684\u003Ccode\u003EpropertyMap\u003C/code\u003E\u003Ca href=\"/free/Mapper/issues/IAB35\" class=\"gfm gfm-issue \" title=\"Issue: \u9879\u76ee\u91cc\u4f7f\u7528Example\u8fd8\u662f\u6bd4\u8f83\u9891\u7e41\u7684\uff0c\u6bcf\u6b21\u521b\u5efa\u90fd\u8981\u521b\u5efa\u4e00\u4e2a\u5c5e\u6027Map\uff08\u80fd\u5426\u7f13\u5b58\uff09\u4ee3\u4ef7\u662f\u4e0d\u662f\u6709\u70b9\u513f\u9ad8\"\u003E#159:\u9879\u76ee\u91cc\u4f7f\u7528Example\u8fd8\u662f\u6bd4\u8f83\u9891\u7e41\u7684\uff0c\u6bcf\u6b21\u521b\u5efa\u90fd\u8981\u521b\u5efa\u4e00\u4e2a\u5c5e\u6027Map\uff08\u80fd\u5426\u7f13\u5b58\uff09\u4ee3\u4ef7\u662f\u4e0d\u662f\u6709\u70b9\u513f\u9ad8\u003C/a\u003E\n\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EExample\u003C/code\u003E\u4e2d\u7684\u003Ccode\u003EandIn\u003C/code\u003E\u548c\u003Ccode\u003EandNotIn\u003C/code\u003E\u4e2d\u7684\u53c2\u6570\u003Ccode\u003ECollection\u003C/code\u003E\u6539\u4e3a\u003Ccode\u003EIterable\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u89e3\u51b3\u9a7c\u5cf0\u8f6c\u4e0b\u5212\u7ebf\u7684\u9519\u8bef\uff0c\u611f\u8c22 ptma, piggsoft \u548c liufor \u7684PR\u003C/li\u003E\n\u003Cli\u003E\u589e\u52a0\u5bf9MBG1.3.4\u7684\u652f\u6301\u003C/li\u003E\n\u003Cli\u003EMBG\u63d2\u4ef6\u652f\u6301\u003Ccode\u003EbeginningDelimiter\u003C/code\u003E\u548c\u003Ccode\u003EendingDelimiter\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003EMBG\u63d2\u4ef6\u589e\u52a0schema\u914d\u7f6e\uff08catalog\u4e5f\u53ef\u4ee5\u7528\u8fd9\u4e2a\uff09\uff0c\u4f1a\u81ea\u52a8\u5728\u8868\u7684\u6ce8\u89e3\u540d\u5b57\u524d\u9762\u52a0\u4e0a\u003Ccode\u003Eschema.tablename\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003EMBG\u63d2\u4ef6\u652f\u6301oracle\u83b7\u53d6\u6ce8\u91ca\uff0c\u5176\u4ed6\u6570\u636e\u5e93\u53ef\u4ee5\u5c1d\u8bd5\u003Ca href=\"/free/Mapper/issues/I8URW\" class=\"gfm gfm-issue \" title=\"Issue: \u4f7f\u7528oracle\u81ea\u52a8\u751f\u6210po\u6ca1\u6709column\u6ce8\u91ca\"\u003E#114:\u4f7f\u7528oracle\u81ea\u52a8\u751f\u6210po\u6ca1\u6709column\u6ce8\u91ca\u003C/a\u003E\n\u003C/li\u003E\n\u003Cli\u003EMBG\u6269\u5c55\uff0c\u8be6\u60c5\u770b\u003Ca href=\"http://blog.csdn.net/isea533/article/details/52430691\"\u003EMyBatis Generator 1.3.4 \u6269\u5c55\uff0c\u53ef\u4ee5\u8bbe\u7f6e Mapper\uff08Dao\uff09\u540e\u7f00\u003C/a\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"3-3-8-2016-03-23_1\" href=\"#3-3-8-2016-03-23_1\"\u003E\u003C/a\u003E3.3.8 - 2016-03-23\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u003Ccode\u003EExample\u003C/code\u003E\u7684\u003Ccode\u003EandIn\u003C/code\u003E\u548c\u003Ccode\u003EandNotIn\u003C/code\u003E\u65b9\u6cd5\u53c2\u6570\u6539\u4e3a\u003Ccode\u003ECollection\u003C/code\u003E \u003Ca href=\"/free/Mapper/issues/I8Q2M\" class=\"gfm gfm-issue \" title=\"Issue: Example.createCriteria().andIn()/andNotIn()\u7684\u53c2\u6570\u662f\u5426\u53ef\u4ee5\u6539\u6210 Collection\u0026lt;?\u0026gt;\"\u003E#109:Example.createCriteria().andIn()/andNotIn()\u7684\u53c2\u6570\u662f\u5426\u53ef\u4ee5\u6539\u6210 Collection\u0026lt;?\u0026gt;\u003C/a\u003E\n\u003C/li\u003E\n\u003Cli\u003E\u89e3\u51b3ResultMapping.Builder3.2.6\u7248\u672c\u65b0\u589e\u003Ccode\u003Elazy\u003C/code\u003E\u65b9\u6cd5\u5bfc\u81f4\u65e0\u6cd5\u517c\u5bb93.2.4~3.2.5\u7248\u672c\u7684\u95ee\u9898\uff0c\u4ecd\u7136\u517c\u5bb93.2.4+\u003C/li\u003E\n\u003Cli\u003E\u89e3\u51b3github\u003Ca href=\"https://github.com/abel533/Mapper/issues/12\"\u003E\u003C/a\u003E\u003Ca href=\"/free/Mapper/issues/I67EL\" class=\"gfm gfm-issue \" title=\"Issue: \u914d\u7f6e\u591a\u4e2amapper\u65f6 \u5b57\u7b26\u8d8a\u754c\"\u003E#12:\u914d\u7f6e\u591a\u4e2amapper\u65f6 \u5b57\u7b26\u8d8a\u754c\u003C/a\u003E\u003Ca href=\"https://github.com/abel533/Mapper/issues/12\"\u003E\u003C/a\u003E \u95ee\u9898\u003C/li\u003E\n\u003Cli\u003E\u89e3\u51b3\u003Ca href=\"/free/Mapper/issues/I8N2Z\" class=\"gfm gfm-issue \" title=\"Issue: @table \u4e2d schema \u8bbe\u7f6e\u65e0\u6548\u7684\u95ee\u9898\"\u003E#107:@table \u4e2d schema \u8bbe\u7f6e\u65e0\u6548\u7684\u95ee\u9898\u003C/a\u003E\n\u003C/li\u003E\n\u003Cli\u003E\u89e3\u51b3\u548c\u5206\u9875\u63d2\u4ef6PageHelper\u4e2dorderBy\u9ed8\u8ba4\u5c5e\u6027\u540d\u76f8\u540c\u5bfc\u81f4\u6392\u5e8f\u7684\u9519\u8bef\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"3-3-7-2016-03-12_1\" href=\"#3-3-7-2016-03-12_1\"\u003E\u003C/a\u003E3.3.7 - 2016-03-12\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u003Ccode\u003EExample\u003C/code\u003E\u589e\u52a0\u003Ccode\u003EorderBy\u003C/code\u003E\u65b9\u6cd5\uff0c\u4f7f\u7528\u5c5e\u6027\u8fdb\u884c\u6392\u5e8f\uff0c\u4f8b\u5982\uff1a\u003Ccode\u003Eexample.orderBy(\u0026quot;id\u0026quot;).desc().orderBy(\u0026quot;countryname\u0026quot;).orderBy(\u0026quot;countrycode\u0026quot;).asc();\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u5f53\u5b9e\u4f53\u7c7b\u5305\u542b\u6570\u7ec4\u7c7b\u578b\u7684\u5b57\u6bb5\u65f6\uff0c\u5728\u003Ccode\u003EresultMap\u003C/code\u003E\u4e2d\u4e0d\u4f7f\u7528\u003Ccode\u003EjavaType\u003C/code\u003E\uff0c\u8fd9\u79cd\u60c5\u51b5\u5982\u679c\u51fa\u9519\uff0c\u53ef\u4ee5\u901a\u8fc7\u003Ccode\u003E@ColumnType\u003C/code\u003E\u6ce8\u89e3\u8bbe\u7f6e\u003Ccode\u003EjdbcType\u003C/code\u003E \u003Ca href=\"/free/Mapper/issues/I8JZO\" class=\"gfm gfm-issue \" title=\"Issue: \u6570\u7ec4\u7c7b\u578b\u5904\u7406\u6709\u95ee\u9898\"\u003E#103:\u6570\u7ec4\u7c7b\u578b\u5904\u7406\u6709\u95ee\u9898\u003C/a\u003E\n\u003C/li\u003E\n\u003Cli\u003E\u5b9e\u4f53\u7c7b\u4e2d\u5ffd\u7565\u003Ccode\u003Etransient\u003C/code\u003E\u7c7b\u578b\u7684\u5b57\u6bb5\u003Ca href=\"/free/Mapper/issues/I8MBE\" class=\"gfm gfm-issue \" title=\"Issue: \u62fc\u63a5\u7684SQL\u4e2d\u4e0d\u5e94\u8be5\u5305\u542btransient\u7c7b\u578b\u7684\u5b57\u6bb5\"\u003E#106:\u62fc\u63a5\u7684SQL\u4e2d\u4e0d\u5e94\u8be5\u5305\u542btransient\u7c7b\u578b\u7684\u5b57\u6bb5\u003C/a\u003E\n\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"3-3-6-2016-02-20_1\" href=\"#3-3-6-2016-02-20_1\"\u003E\u003C/a\u003E3.3.6 - 2016-02-20\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u589e\u52a0\u5bf9mybatis-spring 1.2.4\u7248\u672c\u7684\u652f\u6301\uff0c\u517c\u5bb9\u4e4b\u524d\u7684\u7248\u672c\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"3-3-5-2016-02-16_1\" href=\"#3-3-5-2016-02-16_1\"\u003E\u003C/a\u003E3.3.5 - 2016-02-16\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u003Ccode\u003EExample\u003C/code\u003E\u589e\u52a0\u5bf9\u52a8\u6001\u8868\u540d\u652f\u6301\uff0c\u901a\u8fc7\u003Ccode\u003EsetTableName\u003C/code\u003E\u8bbe\u7f6e\u8868\u540d\u003C/li\u003E\n\u003Cli\u003E\u5728example\u76f8\u5173\u7684\u4e24\u4e2a\u003Ccode\u003Eupdate\u003C/code\u003E\u65b9\u6cd5\u4e2d\uff0c\u53c2\u6570\u4e3a\u5b9e\u4f53\u7c7b\u548c\u003Ccode\u003EExample\u003C/code\u003E\uff0c\u8fd9\u4e2a\u65b9\u6cd5\u53ea\u80fd\u901a\u8fc7\u003Ccode\u003EExample\u003C/code\u003E\u6765\u8bbe\u7f6e\u52a8\u6001\u8868\u540d\uff0c\u4e0d\u652f\u6301\u901a\u8fc7\u5b9e\u4f53\u8bbe\u7f6e\u52a8\u6001\u8868\u540d\u003C/li\u003E\n\u003Cli\u003E\u4f18\u5316\u4e24\u4e2a\u003Ccode\u003Eselect count\u003C/code\u003E\u67e5\u8be2\uff0c\u5f53\u8868\u53ea\u6709\u4e00\u4e2a\u4e3b\u952e\u7684\u65f6\u5019\uff0c\u4f7f\u7528\u003Ccode\u003Eselect count(pk)\u003C/code\u003E\uff0c\u5176\u4ed6\u65f6\u5019\u4f7f\u7528\u003Ccode\u003Eselect count(*)\u003C/code\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"3-3-4-2016-01-05_1\" href=\"#3-3-4-2016-01-05_1\"\u003E\u003C/a\u003E3.3.4 - 2016-01-05\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u89e3\u51b3insertList\u7684bug#86\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EExample\u003C/code\u003E\u6784\u9020\u65b9\u6cd5\u589e\u52a0\u003Ccode\u003EnotNull\u003C/code\u003E\u53c2\u6570\uff0c\u9ed8\u8ba4\u003Ccode\u003Efalse\u003C/code\u003E\uff0c\u5141\u8bb8\u503c\u4e3a\u003Ccode\u003Enull\u003C/code\u003E\uff0c\u503c\u4e3a\u003Ccode\u003Enull\u003C/code\u003E\u7684\u65f6\u5019\u4e0d\u52a0\u5165\u5230\u6761\u4ef6\u4e2d\u3002\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EseqFormat\u003C/code\u003E\u683c\u5f0f\u5316\u53c2\u6570\u589e\u52a0\u7b2c\u56db\u4e2a\u53ef\u914d\u7f6e\u503c\u003Ccode\u003ETableName\u003C/code\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"3-3-3-2015-12-30_1\" href=\"#3-3-3-2015-12-30_1\"\u003E\u003C/a\u003E3.3.3 - 2015-12-30\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u89e3\u51b3OGNL\u4e2d\u7684and,or\u5927\u5199\u5bfc\u81f4\u7684\u9519\u8bef\u003C/li\u003E\n\u003Cli\u003E\u89e3\u51b3SpecialProvider\u4e0d\u652f\u6301insertable\u7684bug#77\u003C/li\u003E\n\u003Cli\u003E\u89e3\u51b3JDK6,7\u65e0\u6cd5\u83b7\u53d6\u5b57\u6bb5\u6cdb\u578b\u7c7b\u578b\u7684\u95ee\u9898\u3002\u003C/li\u003E\n\u003Cli\u003E\u63d0\u4f9b\u4e00\u4e2aSpring Boot\u96c6\u6210\u7684\u793a\u4f8b: \u003Ca target=\"_blank\" href=\"https://github.com/abel533/MyBatis-Spring-Boot\"\u003Ehttps://github.com/abel533/MyBatis-Spring-Boot\u003C/a\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"3-3-2-2015-12-12_1\" href=\"#3-3-2-2015-12-12_1\"\u003E\u003C/a\u003E3.3.2 - 2015-12-12\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u89e3\u51b3\u6570\u636e\u8d8a\u754cbug#73\u003C/li\u003E\n\u003Cli\u003E\u89e3\u51b3and\u5c11\u7a7a\u683c\u95ee\u9898\u003C/li\u003E\n\u003Cli\u003E\u89e3\u51b3order by\u9519\u8bef\u003Ca href=\"/free/Mapper/issues/I80IV\" class=\"gfm gfm-issue \" title=\"Issue: sql.append(\u0026quot;order by ${orderByClause}\\\u0026quot;)\u0026quot;);\u591a\u4e2a\\\u0026quot;\"\u003E#74:sql.append(\"order by ${orderByClause}\\\")\");\u591a\u4e2a\\\"\u003C/a\u003E\n\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003Etk.mybatis.spring.mapper.MapperScannerConfigurer\u003C/code\u003E\u4e2d\u7684\u5c5e\u6027\u003Ccode\u003EmapperHelper\u003C/code\u003E\u589e\u52a0setter\u548cgetter\u65b9\u6cd5\uff0c\u65b9\u4fbf\u901a\u8fc7\u4ee3\u7801\u8fdb\u884c\u914d\u7f6e\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"3-3-1-2015-12-09_1\" href=\"#3-3-1-2015-12-09_1\"\u003E\u003C/a\u003E3.3.1 - 2015-12-09\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u589e\u52a0\u003Ccode\u003EenableMethodAnnotation\u003C/code\u003E\u53c2\u6570\uff0c\u53ef\u4ee5\u63a7\u5236\u662f\u5426\u652f\u6301\u65b9\u6cd5\u4e0a\u7684JPA\u6ce8\u89e3\uff0c\u9ed8\u8ba4\u003Ccode\u003Efalse\u003C/code\u003E\u3002\n\u8bbe\u7f6e\u003Ccode\u003EenableMethodAnnotation = true\u003C/code\u003E\u7684\u65f6\u5019\u6ce8\u610f\uff0c\u5982\u003Ccode\u003EgetRealName\u003C/code\u003E\u6216\u003Ccode\u003EsetYourName\u003C/code\u003E\u90fd\u4f1a\u4ea7\u751f\u003Ccode\u003ErealName\u003C/code\u003E\u5c5e\u6027\u6216\u003Ccode\u003EyourName\u003C/code\u003E\u5c5e\u6027\uff0c\u5982\u679c\u8be5\u65b9\u6cd5\u5bf9\u5e94\u7684\u5c5e\u6027\u4e0d\u662f\u8868\u4e2d\u7684\u5b57\u6bb5\uff0c\u5c31\u9700\u8981\u7ed9\u65b9\u6cd5\u589e\u52a0\u003Ccode\u003E@Transient\u003C/code\u003E\u6ce8\u89e3\u3002\n\u540c\u6837\u5982\u679c\u4f60\u7684\u5b9e\u4f53\u662f\u7ee7\u627f\u003Ccode\u003EMap\u003C/code\u003E\u7c7b\u578b\u7684\uff0c\u4f60\u4e0d\u9700\u8981\u5728\u5b9e\u4f53\u4e2d\u5199\u003Ccode\u003Eprivate String userName\u003C/code\u003E\u8fd9\u6837\u7684\u5c5e\u6027\uff0c\u4f60\u53ea\u9700\u8981\u5199\u003Ccode\u003EsetUserName\u003C/code\u003E\u6216\u003Ccode\u003EgetUserName\u003C/code\u003E\u8fd9\u6837\u7684\u65b9\u6cd5\u5c31\u53ef\u4ee5\u3002\u003C/li\u003E\n\u003Cli\u003E\u5728\u5904\u7406\u7684\u6ce8\u89e3\u7684\u65f6\u5019\uff0c\u4f18\u5148\u4ece\u003Ccode\u003EField\u003C/code\u003E\u83b7\u53d6\uff0c\u7136\u540e\u662f\u003Ccode\u003Esetter\u003C/code\u003E\u65b9\u6cd5\uff0c\u6700\u540e\u662f\u003Ccode\u003Egetter\u003C/code\u003E\u65b9\u6cd5\uff0c\u6ce8\u89e3\u91cd\u590d\u7684\u60c5\u51b5\u4e0b\uff0c\u53ea\u83b7\u53d6\u6309\u987a\u5e8f\u5f97\u5230\u7684\u7b2c\u4e00\u4e2a\u003C/li\u003E\n\u003Cli\u003E\u4e3a\u4e86\u652f\u6301\u5982\u003Ccode\u003Epublic class Country extends Entity\u0026lt;Integer, String\u0026gt;\u003C/code\u003E\u8fd9\u6837\u7684\u6cdb\u578b\u7c7b\u578b,\u5728\u751f\u6210\u003Ccode\u003E#{propertyName}\u003C/code\u003E\u7684\u65f6\u5019\u90fd\u5e26\u4e0a\u4e86\u003Ccode\u003EjavaType\u003C/code\u003E\u5c5e\u6027\u3002\n\u4ea7\u751f\u7684\u7ed3\u679c\u5c31\u662f\u003Ccode\u003E#{propertyName, javaType=java.lang.Integer}\u003C/code\u003E\u8fd9\u6837\u5b50\u7684\uff0c\u8fd9\u4f1a\u5bfc\u81f4\u5f53\u4f60\u8c03\u7528\u65b9\u6cd5\u65f6\uff0c\u5fc5\u987b\u4fdd\u8bc1\u7c7b\u578b\u4e00\u81f4\u3002\n\u4e5f\u5c31\u662f\u5047\u8bbe\u4e3b\u952e\u662f\u003Ccode\u003EInteger id\u003C/code\u003E\uff0c\u8c03\u7528\u003Ccode\u003EselectByPrimaryKey(Object id)\u003C/code\u003E\u7684\u65f6\u5019\uff0c\u53c2\u6570\u003Ccode\u003Eid\u003C/code\u003E\u5fc5\u987b\u4f7f\u7528\u003Ccode\u003E100\u003C/code\u003E\u8fd9\u6837\u7684\u6570\u5b57\uff0c\u4e0d\u80fd\u4f7f\u7528\u003Ccode\u003E\u0026quot;100\u0026quot;\u003C/code\u003E\u5b57\u7b26\u4e32\uff08\u4ee5\u524d\u7248\u672c\u53ef\u4ee5\uff09\u3002\n\u5982\u679c\u4e0d\u5e26\u003Ccode\u003EjavaType\u003C/code\u003E\uff0c\u90a3\u4e48\u5982\u679c\u003Ccode\u003Eid\u003C/code\u003E\u662f\u4e2a\u6cdb\u578b\uff0cMyBatis\u67e5\u627e\u7684\u65f6\u5019\u5c31\u4f1a\u56e0\u4e3a\u627e\u4e0d\u5230\u6b63\u786e\u7684\u7c7b\u578b\u800c\u629b\u51fa\u5f02\u5e38\u3002\u003C/li\u003E\n\u003Cli\u003E\u4e3a\u4e86\u8ba9\u6269\u5c55\u66f4\u65b9\u4fbf\uff0c\u5c06\u003Ccode\u003Etk.mybatis.mapper.provider\u003C/code\u003E\u5305\u4e0b\u6240\u6709\u7684\u901a\u7528\u63a5\u53e3\u7684\u5b9e\u73b0\u65b9\u6cd5\u6539\u4e3a\u4e86\u003Ccode\u003EString\u003C/code\u003E\u5f62\u5f0f\u3002\n\u81ea\u5df1\u6269\u5c55\u5355\u8868\u64cd\u4f5c\u7684\u65b9\u6cd5\u662f\u975e\u5e38\u5bb9\u6613\u7684\u4e8b\u60c5\uff0c\u5efa\u8bae\u6709\u4e00\u5b9a\u901a\u7528Mapper\u4f7f\u7528\u57fa\u7840\u7684\u81ea\u884c\u6269\u5c55\uff0c\u6269\u5c55\u53ef\u4ee5\u53c2\u8003\u003Ca href=\"http://git.oschina.net/free/Mapper/blob/master/wiki/mapper3/6.MyMapper.md\"\u003E\u5982\u4f55\u6269\u5c55\u901a\u7528\u63a5\u53e3\u003C/a\u003E\u003C/li\u003E\n\u003Cli\u003E\u65b0\u589e\u003Ccode\u003ESqlHelper\u003C/code\u003E\u5de5\u5177\u7c7b\uff0c\u5176\u4e2d\u5305\u542b\u4e86\u5927\u91cf\u53ef\u7528\u7684\u73b0\u6210\u7684SQL\u65b9\u6cd5\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003E@Column\u003C/code\u003E\u6ce8\u89e3\u589e\u52a0\u5bf9\u003Ccode\u003Einsertable\u003C/code\u003E\u548c\u003Ccode\u003Eupdatable\u003C/code\u003E\u5c5e\u6027\u7684\u652f\u6301\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"3-3-0-2015-11-01_1\" href=\"#3-3-0-2015-11-01_1\"\u003E\u003C/a\u003E3.3.0 - 2015-11-01\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u003Cp\u003E\u589e\u52a0\u5bf9\u52a8\u6001\u8868\u540d\u7684\u652f\u6301\uff0c\u9700\u8981\u5b9e\u4f53\u7c7b\u7ee7\u627f\u003Ccode\u003EIDynamicTableName\u003C/code\u003E\u63a5\u53e3\uff0c\u7528\u6cd5\u89c1\u003Ca href=\"http://git.oschina.net/free/Mapper/blob/master/wiki/mapper3/3.2.Use330.md\"\u003E\u8be6\u7ec6\u8bf4\u660e\u003C/a\u003E\u003C/p\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003E\u003Ccode\u003EExample\u003C/code\u003E\u589e\u52a0\u81ea\u5b9a\u4e49\u67e5\u8be2\u6761\u4ef6\uff0c\u63d0\u4f9b\u4e864\u4e2a\u65b9\u6cd5\uff0c\u5177\u4f53\u65b9\u6cd5\u548c\u7528\u6cd5\u89c1\u003Ca href=\"http://git.oschina.net/free/Mapper/blob/master/wiki/mapper3/3.2.Use330.md\"\u003E\u8be6\u7ec6\u8bf4\u660e\u003C/a\u003E\u003C/p\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003E\u65b0\u589e\u003Ccode\u003E@ColumnType\u003C/code\u003E\u6ce8\u89e3\uff0c\u53ef\u4ee5\u5355\u72ec\u8bbe\u7f6e\u5217\u7684\u003Ccode\u003EjdbcType\u003C/code\u003E\u548c\u003Ccode\u003EtypeHandler\u003C/code\u003E\u003C/p\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003E\u003Ccode\u003EExample\u003C/code\u003E\u7684\u003Ccode\u003Ein\u003C/code\u003E\u548c\u003Ccode\u003Enot in\u003C/code\u003E\u4e2d\u7684\u003Ccode\u003EList\u0026lt;Object\u0026gt;\u003C/code\u003E\u53c2\u6570\u6539\u4e3a\u003Ccode\u003EList\u0026lt;?\u0026gt;\u003C/code\u003E\uff0c\u5141\u8bb8\u4efb\u610f\u7c7b\u578b\u003C/p\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003Eselect\u67e5\u8be2\u65b9\u6cd5\u8fd4\u56de\u7c7b\u578b\u4e0d\u5728\u4f7f\u7528\u003Ccode\u003EresultType\u003C/code\u003E\uff0c\u6539\u4e3a\u003Ccode\u003EresultMap\u003C/code\u003E\uff0c\u56e0\u6b64\u53ef\u4ee5\u652f\u6301\u003Ccode\u003EtypeHandler\u003C/code\u003E\u7684\u8bfb\u53d6\u003C/p\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003E\u003Ccode\u003EStyle\u003C/code\u003E\u81ea\u52a8\u8f6c\u65b9\u5f0f\u65b0\u589e\u003Ccode\u003EcamelhumpAndUppercase\u003C/code\u003E\u9a7c\u5cf0\u8f6c\u4e0b\u5212\u7ebf\u5927\u5199\u5f62\u5f0f,\u003Ccode\u003EcamelhumpAndLowercase\u003C/code\u003E\u9a7c\u5cf0\u8f6c\u4e0b\u5212\u7ebf\u5c0f\u5199\u5f62\u5f0f\u003C/p\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003EMapperTemplate\u4e2d\u7684\u003Ccode\u003EgetSelectReturnType\u003C/code\u003E\u65b9\u6cd5\u6539\u4e3a\u003Ccode\u003EgetEntityClass\u003C/code\u003E\uff0c\u003Ccode\u003EgetBEFORE\u003C/code\u003E\u6539\u4e3a\u003Ccode\u003EisBEFORE\u003C/code\u003E\u003C/p\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003E\u6587\u6863\u4e2d\u589e\u52a0\u003Ccode\u003E@GeneratedValue(strategy = GenerationType.IDENTITY)\u003C/code\u003E\u7684\u4e00\u79cd\u91cd\u8981\u003Ca href=\"http://git.oschina.net/free/Mapper/blob/master/wiki/mapper3/3.2.Use330.md\"\u003E\u7528\u6cd5\u8bf4\u660e\u003C/a\u003E\u003C/p\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003E\u4fee\u590dselectAll\u4e0d\u652f\u6301\u003Ccode\u003E@OrderBy\u003C/code\u003E\u6ce8\u89e3\u7684bug\u003C/p\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003E\u89e3\u51b3\u4e00\u4e2a\u9a7c\u5cf0\u8f6c\u6362bug\uff0c\u4f8b\u5982\u003Ccode\u003EhelloWorld\u003C/code\u003E\u4f1a\u8f6c\u6362\u4e3a\u003Ccode\u003Ehello_world\u003C/code\u003E\uff08\u539f\u5148\u662f\u003Ccode\u003Ehello_World\u003C/code\u003E\uff09\u003C/p\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"3-2-2-2015-09-19_1\" href=\"#3-2-2-2015-09-19_1\"\u003E\u003C/a\u003E3.2.2 - 2015-09-19\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u548cSpring\u96c6\u6210\u65f6\uff0c\u5141\u8bb8\u901a\u8fc7\u003Ccode\u003EmarkerInterface\u003C/code\u003E\u5c5e\u6027\u914d\u7f6e\u901a\u7528\u63a5\u53e3\uff08\u6ce8\u610f\u8be5\u5c5e\u6027\u7684\u539f\u6709\u4f5c\u7528\u4e0d\u53d8\uff09\uff0c\u60f3\u8981\u8ba9\u8be5\u63a5\u53e3\u81ea\u52a8\u6ce8\u518c\uff0c\u8be5\u63a5\u53e3\u5c31\u9700\u8981\u7ee7\u627f\u003Ccode\u003Etk.mybatis.mapper.common.Marker\u003C/code\u003E\u63a5\u53e3\uff0c\u003Ccode\u003EMapper\u0026lt;T\u0026gt;\u003C/code\u003E\u9ed8\u8ba4\u7ee7\u627f\u8be5\u63a5\u53e3\uff0c\u6240\u4ee5\u5982\u679c\u81ea\u5df1\u7684\u63a5\u53e3\u662f\u7ee7\u627f\u003Ccode\u003EMapper\u0026lt;T\u0026gt;\u003C/code\u003E\u7684\uff0c\u4e0d\u9700\u8981\u518d\u7ee7\u627f\u3002\u003C/li\u003E\n\u003Cli\u003E\u89e3\u51b3\u6ce8\u518c\u9ed8\u8ba4\u63a5\u53e3\u65f6\u5b58\u5728\u7684bug\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"3-2-1-2015-09-02_1\" href=\"#3-2-1-2015-09-02_1\"\u003E\u003C/a\u003E3.2.1 - 2015-09-02\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u89e3\u51b3spring\u96c6\u6210\u4e2d\u53ef\u80fd\u51fa\u73b0definition.getBeanClassName()\u7a7a\u6307\u9488\u5f02\u5e38bug\u003Ca href=\"http://git.oschina.net/free/Mapper/issues/49\"\u003E\u003C/a\u003E\u003Ca href=\"/free/Mapper/issues/I7D60\" class=\"gfm gfm-issue \" title=\"Issue: definition.getBeanClassName()\u7a7a\u6307\u9488\u5f02\u5e38\"\u003E#49:definition.getBeanClassName()\u7a7a\u6307\u9488\u5f02\u5e38\u003C/a\u003E\u003Ca href=\"http://git.oschina.net/free/Mapper/issues/49\"\u003E\u003C/a\u003E\u003C/li\u003E\n\u003Cli\u003E\u5173\u4e8e3.2.x\u7248\u672c\uff0c\u8bf7\u4ed4\u7ec6\u770b3.2.0\u7684\u66f4\u65b0\u65e5\u5fd7\uff0c\u6700\u65b0\u7248\u672c\u7684\u6587\u6863\u4e5f\u662f\u9488\u5bf93.2.x\u7248\u672c\u7684\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"3-2-0-2015-09-02_1\" href=\"#3-2-0-2015-09-02_1\"\u003E\u003C/a\u003E3.2.0 - 2015-09-02\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u79fb\u9664\u003Ccode\u003EMapperInterceptor\u003C/code\u003E\u62e6\u622a\u5668\uff0c\u4ee5\u540e\u4e0d\u80fd\u5728\u901a\u8fc7\u62e6\u622a\u5668\u914d\u7f6e\u003C/li\u003E\n\u003Cli\u003E\u589e\u52a0mybatis-spring\u7279\u6b8a\u652f\u6301\uff0c\u4e3b\u8981\u662f\u6839\u636emybatis-spring\u9879\u76ee\u589e\u52a0\u4e86\u4e0b\u9762\u4e24\u4e2a\u7c7b\uff1a\n\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u003Ccode\u003Etk.mybatis.spring.mapper.MapperScannerConfigurer\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003Etk.mybatis.spring.mapper.MapperFactoryBean\u003C/code\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003C/li\u003E\n\u003Cli\u003E\u8fd9\u4e24\u4e2a\u7c7b\u548cMyBatis\u63d0\u4f9b\u7684\u533a\u522b\u662f\u589e\u52a0\u4e86MapperHelper\u5c5e\u6027\uff0c\u901a\u8fc7\u5728\u003Ccode\u003EMapperScannerConfigurer\u003C/code\u003E\u4e2d\u4f7f\u7528\u003Ccode\u003Eproperties\u003C/code\u003E\u5c5e\u6027\u6ce8\u5165\u914d\u7f6e\u003C/li\u003E\n\u003Cli\u003E\u8fd9\u4e24\u4e2a\u7c7b\uff0c\u5728\u5168\u540d\u4e0a\u548cMyBatis\u7684\u533a\u522b\u662f\u003Ccode\u003Eorg.mybatis.xxx\u003C/code\u003E\u6539\u4e3a\u4e86\u003Ccode\u003Etk.mybatis.xxx\u003C/code\u003E\uff0c\u540d\u5b57\u76f8\u8fd1\uff0c\u66f4\u65b9\u4fbf\u4fee\u6539\u914d\u7f6e\u003C/li\u003E\n\u003Cli\u003E\u548cSpring\u96c6\u6210\u65b9\u6cd5\uff1a\u003C/li\u003E\n\u003C/ul\u003E\n\u003Cdiv class=\"white\"\u003E\u003Cdiv class=\"highlight\"\u003E\u003Cpre\u003E\u003Cspan class=\"nt\"\u003E\u0026lt;bean\u003C/span\u003E \u003Cspan class=\"na\"\u003Eclass=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"tk.mybatis.spring.mapper.MapperScannerConfigurer\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"nt\"\u003E\u0026lt;property\u003C/span\u003E \u003Cspan class=\"na\"\u003Ename=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"basePackage\"\u003C/span\u003E \u003Cspan class=\"na\"\u003Evalue=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"com.isea533.mybatis.mapper\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E/\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"nt\"\u003E\u0026lt;property\u003C/span\u003E \u003Cspan class=\"na\"\u003Ename=\u003C/span\u003E\u003Cspan class=\"s\"\u003E\"properties\"\u003C/span\u003E\u003Cspan class=\"nt\"\u003E\u0026gt;\u003C/span\u003E\n        \u003Cspan class=\"nt\"\u003E\u0026lt;value\u0026gt;\u003C/span\u003E\n            mappers=tk.mybatis.mapper.common.Mapper\n        \u003Cspan class=\"nt\"\u003E\u0026lt;/value\u0026gt;\u003C/span\u003E\n    \u003Cspan class=\"nt\"\u003E\u0026lt;/property\u0026gt;\u003C/span\u003E\n\u003Cspan class=\"nt\"\u003E\u0026lt;/bean\u0026gt;\u003C/span\u003E\n\u003C/pre\u003E\u003C/div\u003E\u003C/div\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u8fd9\u79cd\u914d\u7f6e\u65b9\u5f0f\u662f\u4e0d\u662f\u7b80\u5355\u7684\u4e0d\u80fd\u518d\u7b80\u5355\u4e86?\u003C/li\u003E\n\u003Cli\u003E\u589e\u52a0\u003Ccode\u003Estyle\u003C/code\u003E\u5c5e\u6027\u914d\u7f6e\uff0c\u7528\u6765\u914d\u7f6e\u5bf9\u8c61\u540d/\u5b57\u6bb5\u548c\u8868\u540d/\u5b57\u6bb5\u4e4b\u95f4\u7684\u8f6c\u6362\u65b9\u5f0f\uff0c\u53ef\u9009\u503c\uff1a\n\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u003Ccode\u003Enormal\u003C/code\u003E:\u4f7f\u7528\u5b9e\u4f53\u7c7b\u540d/\u5c5e\u6027\u540d\u4f5c\u4e3a\u8868\u540d/\u5b57\u6bb5\u540d\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003Ecamelhump\u003C/code\u003E:\u003Cb\u003E\u8fd9\u662f\u9ed8\u8ba4\u503c\u003C/b\u003E\uff0c\u9a7c\u5cf0\u8f6c\u6362\u4e3a\u4e0b\u5212\u7ebf\u5f62\u5f0f\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003Euppercase\u003C/code\u003E:\u8f6c\u6362\u4e3a\u5927\u5199\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003Elowercase\u003C/code\u003E:\u8f6c\u6362\u4e3a\u5c0f\u5199\u003C/li\u003E\n\u003C/ul\u003E\n\u003C/li\u003E\n\u003Cli\u003E\u589e\u52a0\u5b9e\u4f53\u6ce8\u89e3\u003Ccode\u003E@NameStyle\u003C/code\u003E\uff0c\u8be5\u6ce8\u89e3\u4f18\u5148\u4e8e\u5168\u5c40\u914d\u7f6e\u003Ccode\u003Estyle\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u89e3\u51b3\u003Ccode\u003Eexample.selectProperties\u003C/code\u003E\u6620\u5c04\u9519\u8bef\u7684bug\u003Ca href=\"http://git.oschina.net/free/Mapper/issues/48\"\u003E\u003C/a\u003E\u003Ca href=\"/free/Mapper/issues/I7CG5\" class=\"gfm gfm-issue \" title=\"Issue: Example\u589e\u52a0\u4e86example.selectProperties \u7684\u95ee\u9898\"\u003E#48:Example\u589e\u52a0\u4e86example.selectProperties \u7684\u95ee\u9898\u003C/a\u003E\u003Ca href=\"http://git.oschina.net/free/Mapper/issues/48\"\u003E\u003C/a\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"3-1-3-2015-08-25_1\" href=\"#3-1-3-2015-08-25_1\"\u003E\u003C/a\u003E3.1.3 - 2015-08-25\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u53bb\u6389\u4e863.1.3-SNAPSHOT\u7248\u672c\u4e2d\u7684\u003Ccode\u003EMapperOnceInterceptor\u003C/code\u003E\u62e6\u622a\u5668\uff0c\u4e0b\u4e2a\u7248\u672c\u4f1a\u5b8c\u5584\u003Ccode\u003EMapperHelper\u003C/code\u003E\u7684\u914d\u7f6e\u65b9\u5f0f\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EExample\u003C/code\u003E\u589e\u52a0\u4e86\u003Ccode\u003Eexample.selectProperties(\u0026quot;id\u0026quot;, \u0026quot;countryname\u0026quot;, ...)\u003C/code\u003E\u65b9\u6cd5\uff0c\u53ef\u4ee5\u6307\u5b9a\u67e5\u8be2\u5217\uff0c\u6ce8\u610f\u8fd9\u91cc\u53c2\u6570\u5199\u7684\u662f\u5c5e\u6027\u540d\uff0c\u003Ccode\u003EExample\u003C/code\u003E\u4f1a\u81ea\u52a8\u6620\u5c04\u5230\u5217\u540d\u003C/li\u003E\n\u003Cli\u003E\u003Ccode\u003EExample\u003C/code\u003E\u589e\u52a0\u003Ccode\u003EandEqualTo(\u5b9e\u4f53\u5bf9\u8c61)\u003C/code\u003E\u65b9\u6cd5\uff0c\u53ef\u4ee5\u5c06\u4e00\u4e2a\u5b9e\u4f53\u653e\u8fdb\u53bb\uff0c\u4f1a\u81ea\u52a8\u6839\u636e\u5c5e\u6027\u548c\u503c\u62fc\u51facolumn=value\u7684\u6761\u4ef6 \u003Cb\u003EBob - \u003Ca target=\"_blank\" href=\"0haizhu0@gmail.com\"\u003E0haizhu0@gmail.com\u003C/a\u003E \u63d0\u4f9b\u003C/b\u003E\n\u003C/li\u003E\n\u003Cli\u003EMyBatis\u5728\u5904\u7406\u003Ccode\u003E\u0026lt;cache/\u0026gt;\u003C/code\u003E\u548c\u003Ccode\u003E@CacheNamespace\u003C/code\u003E\u7684\u65f6\u5019\u4e0d\u7edf\u4e00\uff0c\u53ea\u6709\u4e00\u4e2a\u80fd\u751f\u6548\uff0c\u8fd9\u5bfc\u81f4xml\u4e2d\u914d\u7f6e\u4e8c\u7ea7\u7f13\u5b58\u5bf9\u901a\u7528Mapper\u6ce8\u89e3\u5f62\u5f0f\u7684\u65b9\u6cd5\u65e0\u6548\uff0c\u8be5\u95ee\u9898\u5df2\u89e3\u51b3\u003C/li\u003E\n\u003Cli\u003E\u4e8c\u7ea7\u7f13\u5b58\u914d\u7f6e\u65b9\u6cd5\uff0c\u5982\u679c\u63a5\u53e3\u6709\u5bf9\u5e94\u7684xml\uff0c\u5728xml\u4e2d\u914d\u7f6e\u4e8c\u7ea7\u7f13\u5b58\u3002\u5982\u679c\u53ea\u6709\u63a5\u53e3\u6ca1\u6709xml\uff0c\u7528\u6ce8\u89e3\u914d\u7f6e\u4e8c\u7ea7\u7f13\u5b58\u5373\u53ef\u003C/li\u003E\n\u003Cli\u003E\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u4e8c\u7ea7\u7f13\u5b58\u5728xml\u914d\u7f6e\u65f6\uff0c\u53ea\u5bf9\u901a\u7528Mapper\u65b9\u6cd5\u6709\u6548\uff0c\u81ea\u5df1\u7528\u003Ccode\u003E@Select\u003C/code\u003E\u7b49\u6ce8\u89e3\u5b9a\u4e49\u7684\u8fd9\u79cd\u4ecd\u7136\u65e0\u6548\uff0c\u8fd9\u79cd\u60c5\u51b5\u53ea\u80fd\u5728xml\u4e2d\u5b9a\u4e49\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"3-1-2-2015-07-14_1\" href=\"#3-1-2-2015-07-14_1\"\u003E\u003C/a\u003E3.1.2 - 2015-07-14\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u89e3\u51b3\u522b\u540d\u65f6\u7684\u4e00\u79cd\u7279\u6b8a\u60c5\u51b5\uff0c\u4f8b\u5982\u003Ccode\u003E@Column(name=\u0026quot;\u003C/code\u003Edesc\u003Ccode\u003E\u0026quot;)\u003C/code\u003E\u7684\u65f6\u5019\uff0c\u5c31\u4e0d\u9700\u8981\u81ea\u52a8\u6dfb\u52a0\u522b\u540d\u003C/li\u003E\n\u003Cli\u003E\u53cd\u5c04\u83b7\u53d6\u6240\u6709\u5217\u540d\u7684\u65f6\u5019\uff0c\u4e0d\u5728\u81ea\u52a8\u8f6c\u6362\u4e3a\u5927\u5199\u5f62\u5f0f\uff0c\u5bf9\u6570\u636e\u5e93\u533a\u5206\u5927\u5c0f\u5199\u7684\u60c5\u51b5\u6709\u7528\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"3-1-1-2015-07-01_1\" href=\"#3-1-1-2015-07-01_1\"\u003E\u003C/a\u003E3.1.1 - 2015-07-01\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u89e3\u51b3\u003Ccode\u003EConditionMapper\u003C/code\u003E\u4e2d\u003Ccode\u003EselectByCondition\u003C/code\u003E\u548c\u003Ccode\u003EupdateByCondition\u003C/code\u003E\u65b9\u6cd5\u9519\u8bef\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"3-1-0-2015-06-10_1\" href=\"#3-1-0-2015-06-10_1\"\u003E\u003C/a\u003E3.1.0 - 2015-06-10\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u57fa\u7840\u5305\u540d\u4ece\u003Ccode\u003Ecom.github.abel533\u003C/code\u003E\u6539\u4e3a\u003Ccode\u003Etk.mybatis.mapper\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003EMaven\u7684groupId\u6539\u4e3a\u003Ccode\u003Etk.mybatis\u003C/code\u003E,artifactId\u4e3a\u003Ccode\u003Emapper\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u589e\u52a0\u548cExample\u529f\u80fd\u7c7b\u4f3c\u7684Condition\u67e5\u8be2\uff0c\u4ec5\u4ec5\u540d\u5b57\u4e0d\u540c\u003C/li\u003E\n\u003Cli\u003E\u66f4\u591a\u8be6\u7ec6\u53d8\u5316\u8bf7\u770b\u003Ca href=\"http://git.oschina.net/free/Mapper/blob/master/wiki/mapper3/5.Mappers.md\"\u003EMapper3\u901a\u7528\u63a5\u53e3\u5927\u5168\u003C/a\u003E\u003C/li\u003E\n\u003Cli\u003E\u5173\u4e8e3.0.x\u7248\u672c\u8bf7\u770b\u003Ca href=\"http://git.oschina.net/free/Mapper/tree/Mapper3.0.x/\"\u003EMapper3.0.x\u003C/a\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"3-0-0-2015-06-04_1\" href=\"#3-0-0-2015-06-04_1\"\u003E\u003C/a\u003E3.0.0 - 2015-06-04\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u5c06\u003Ccode\u003EEntityMapper\u003C/code\u003E\u548c\u003Ccode\u003ESqlMapper\u003C/code\u003E\u79fb\u51fa\uff0c\u73b0\u5728\u662f\u72ec\u7acb\u9879\u76ee\u003Ca href=\"http://git.oschina.net/free/EntityMapper\"\u003EEntityMapper\u003C/a\u003E\u003C/li\u003E\n\u003Cli\u003E\u5c06\u003Ccode\u003EMapper\u0026lt;T\u0026gt;\u003C/code\u003E\u5168\u90e8\u63a5\u53e3\u65b9\u6cd5\u62c6\u5206\u4e3a\u72ec\u7acb\u63a5\u53e3\uff0c\u65b9\u4fbf\u9009\u62e9\u96c6\u6210\u003C/li\u003E\n\u003Cli\u003E\u589e\u52a0\u003Ccode\u003EMySqlMapper\u0026lt;T\u0026gt;\u003C/code\u003E\u5305\u542b\u6279\u91cf\u63d2\u5165\u548c\u5355\u4e2a\u63d2\u5165\uff0c\u6279\u91cf\u63d2\u5165\u53ef\u4ee5\u56de\u5199\u5168\u90e8id\u003C/li\u003E\n\u003Cli\u003E\u589e\u52a0\u003Ccode\u003ERowBoundsMapper\u0026lt;T\u0026gt;\u003C/code\u003E\u5305\u542b\u4e24\u4e2a\u5206\u9875\u67e5\u8be2\uff0c\u53ef\u4ee5\u914d\u5408\u003Ca href=\"http://git.oschina.net/free/Mybatis_PageHelper\"\u003EPageHelper\u003C/a\u003E\u5b9e\u73b0\u7269\u7406\u5206\u9875\u003C/li\u003E\n\u003Cli\u003E\u8be6\u7ec6\u53d8\u5316\u8bf7\u770b\u003Ca href=\"http://git.oschina.net/free/Mapper/blob/master/wiki/mapper3/1.Changes.md\"\u003EMapper3\u53d8\u5316\u003C/a\u003E\u003C/li\u003E\n\u003Cli\u003EMapper2\u8d44\u6df1\u7528\u6237\u8bf7\u770b\u003Ca href=\"http://git.oschina.net/free/Mapper/blob/master/wiki/mapper3/4.Professional.md\"\u003EMapper3\u9ad8\u7ea7\u5e94\u7528\u003C/a\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\"http://git.oschina.net/free/Mapper/blob/master/wiki/mapper3/5.Mappers.md\"\u003EMapper3\u901a\u7528\u63a5\u53e3\u5927\u5168\u003C/a\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Ca href=\"http://git.oschina.net/free/Mapper/blob/master/wiki/mapper3/6.MyMapper.md\"\u003E\u5feb\u901f\u5f00\u53d1\u81ea\u5df1\u7684\u901a\u7528\u63a5\u53e3\u003C/a\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"2-3-4-2015-06-01_1\" href=\"#2-3-4-2015-06-01_1\"\u003E\u003C/a\u003E2.3.4 - 2015-06-01\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u003Cp\u003E\u9ad8\u5e76\u53d1\u65f6selectKey\u4f1a\u4ea7\u751f\u5f02\u5e38\uff0c\u89e3\u51b3\u003Ca href=\"http://git.oschina.net/free/Mapper/issues/32\"\u003E\u003C/a\u003E\u003Ca href=\"/free/Mapper/issues/I6QAA\" class=\"gfm gfm-issue \" title=\"Issue: \u4e00\u5f00\u59cb\u9ad8\u5e76\u53d1\u4f1a\u62a5\u9519\uff1a\u63d0\u793aMapped Statements collection already contains value of xxxx.insert!selectKey\"\u003E#32:\u4e00\u5f00\u59cb\u9ad8\u5e76\u53d1\u4f1a\u62a5\u9519\uff1a\u63d0\u793aMapped Statements collection already contains value of xxxx.insert!selectKey\u003C/a\u003E\u003Ca href=\"http://git.oschina.net/free/Mapper/issues/32\"\u003E\u003C/a\u003E\u003C/p\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003E\u517c\u5bb9MyBatis3.3.0\u7248\u672c\u003C/p\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003E\u003Cb\u003E\u63d0\u524d\u9884\u544a\uff1a\u4e0b\u4e2a\u7248\u672c3.0.0\u4f1a\u5c06\u901a\u7528Mapper\u9879\u76ee\u62c6\u5206\u4e3a\u4e24\u4e2a\u9879\u76ee\uff0c\u4f1a\u6709\u4e00\u4e9b\u5927\u7684\u6539\u52a8\u003C/b\u003E\u003C/p\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"2-3-3-2015-05-14_1\" href=\"#2-3-3-2015-05-14_1\"\u003E\u003C/a\u003E2.3.3 - 2015-05-14\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u003Cp\u003E\u89e3\u51b3Example\u67e5\u8be2\u4e2d\u7684\u003Ccode\u003Eand\u003C/code\u003E\u7f3a\u5c11\u7a7a\u683c\u7684\u95ee\u9898\u003C/p\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003E\u53bb\u6389UUID\u548cJDBC\u4e24\u79cd\u4e3b\u952e\u7b56\u7565\u7c7b\u578b\u4e2d\u5bf9\u5b57\u6bb5\u7c7b\u578b\u7684\u9650\u5236\n\u4e0d\u518d\u9650\u5236\u4e3a\u003Ccode\u003EString\u003C/code\u003E\uff0c\u53ef\u4ee5\u662f\u4efb\u610f\u7b80\u5355\u7c7b\u578b\uff0c\u9700\u8981\u81ea\u5df1\u4fdd\u8bc1\u7c7b\u578b\u5339\u914d\u3002\u4f8b\u5982UUID\u914d\u7f6e\u7684\u7b56\u7565\u53ef\u4ee5\u8fd4\u56de\u003Ccode\u003EInteger\u003C/code\u003E,\u90a3\u4e48\u5b57\u6bb5\u7c7b\u578b\u5fc5\u987b\u662f\u003Ccode\u003EInteger\u003C/code\u003E\u3002\u003C/p\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003EJDBC\u7c7b\u578b\u7684\u4e3b\u952e\u7b56\u7565\u53ef\u4ee5\u914d\u7f6e\u591a\u4e2a\uff0c\u5c31\u76f8\u5f53\u4e8e\u003Ccode\u003EkeyProperties=\u0026quot;id1,id2...\u0026quot;\u003C/code\u003E\u003C/p\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003E\u003Ccode\u003EEntityHelper\u003C/code\u003E\u7684\u003Ccode\u003EgetOrderByClause\u003C/code\u003E\u65b9\u6cd5\u8fd4\u56de\u503c\u4ece\u003Ccode\u003EStringBuilder\u003C/code\u003E\u6539\u4e3a\u003Ccode\u003EString\u003C/code\u003E\uff0c\u89e3\u51b3\u003Ccode\u003E@OrderBy\u003C/code\u003E\u6ce8\u89e3\u65f6\u7684\u5f02\u5e38\u003C/p\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003E\u003Cb\u003E\u63d0\u524d\u9884\u544a\uff1a\u4e0b\u4e2a\u7248\u672c3.0.0\u4f1a\u5c06\u901a\u7528Mapper\u9879\u76ee\u62c6\u5206\u4e3a\u4e24\u4e2a\u9879\u76ee\uff0c\u4f1a\u6709\u4e00\u4e9b\u5927\u7684\u6539\u52a8\u003C/b\u003E\u003C/p\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"2-3-2-2015-04-21_1\" href=\"#2-3-2-2015-04-21_1\"\u003E\u003C/a\u003E2.3.2 - 2015-04-21\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u89e3\u51b3Example\u67e5\u8be2\u4e2din,notin\u65e0\u6548\u7684bug\u003Ca href=\"http://git.oschina.net/free/Mapper/issues/24\"\u003E\u003C/a\u003E\u003Ca href=\"/free/Mapper/issues/I6JJM\" class=\"gfm gfm-issue \" title=\"Issue: andIn\u6761\u4ef6\u65e0\u6548\uff1f\u6211\u53d1\u73b0\u95ee\u9898\u6240\u5728\u4e86\uff0c\u5927\u795e\u7c97\u5fc3\u4e86\u3002\"\u003E#24:andIn\u6761\u4ef6\u65e0\u6548\uff1f\u6211\u53d1\u73b0\u95ee\u9898\u6240\u5728\u4e86\uff0c\u5927\u795e\u7c97\u5fc3\u4e86\u3002\u003C/a\u003E\u003Ca href=\"http://git.oschina.net/free/Mapper/issues/24\"\u003E\u003C/a\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"2-3-1-2015-04-13_1\" href=\"#2-3-1-2015-04-13_1\"\u003E\u003C/a\u003E2.3.1 - 2015-04-13\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u003Cp\u003E\u5b8c\u5584\u6240\u6709\u548cPrimaryKey\u6709\u5173\u7684\u901a\u7528\u67e5\u8be2\u003C/p\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003E\u4fee\u590dMapper\u63a5\u53e3\u4e2dupdate\u64cd\u4f5c\u4f1a\u66f4\u65b0\u4e3b\u952e\u7684bug\u003C/p\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003E\u4fee\u590dMapper\u63a5\u53e3\u4e2d\u4f7f\u7528Example\u67e5\u8be2\u7684\u65f6\u5019\uff0c\u6761\u4ef6and\u524d\u9762\u7f3a\u5c11\u7a7a\u683c\uff0c\u5f71\u54cd\u7f8e\u89c2\u003C/p\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003EMBG\u63d2\u4ef6\u589e\u52a0caseSensitive\u9ed8\u8ba4false\uff0c\u5f53\u6570\u636e\u5e93\u8868\u540d\u533a\u5206\u5927\u5c0f\u5199\u65f6\uff0c\u53ef\u4ee5\u5c06\u8be5\u5c5e\u6027\u8bbe\u7f6e\u4e3atrue\u003C/p\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"2-3-0-2015-04-05_1\" href=\"#2-3-0-2015-04-05_1\"\u003E\u003C/a\u003E2.3.0 - 2015-04-05\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u003Cp\u003EMapper\u63a5\u53e3\u548cEntityMapper\u90fd\u589e\u52a0\u4e86\u003Ccode\u003EselectOne\u003C/code\u003E\u65b9\u6cd5\uff0c\u8be5\u67e5\u8be2\u8fd4\u56de\u503c\u6700\u591a\u53ea\u80fd\u6709\u4e00\u4e2a\uff0c\u5b58\u5728\u591a\u4e2a\u65f6\u629b\u51fa\u5f02\u5e38\u003C/p\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003EMapper\u63a5\u53e3\u548cEntityMapper\u4e2d\uff0c\u8fd4\u56deList\u7684\u67e5\u8be2\u65b9\u6cd5\u90fd\u652f\u6301JPA\u7684\u003Ccode\u003E@Orderby\u003C/code\u003E\u6ce8\u89e3\u3002\u5176\u4e2d\u003Ccode\u003EExample\u003C/code\u003E\u67e5\u8be2\u4e2d\u7684\u003Ccode\u003Eorderby\u003C/code\u003E\u4f1a\u8986\u76d6\u6ce8\u89e3\u7684\u003Ccode\u003E@Orderby\u003C/code\u003E\u8bbe\u7f6e\u3002\u003C/p\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003E\u901a\u8fc7\u5b9e\u4f53\u7c7b\u83b7\u53d6\u8868\u540d\u7684\u65f6\u5019\uff0c\u4e0d\u5bf9\u8868\u540d\u8fdb\u884c\u5f3a\u5236\u7684\u5927\u5c0f\u5199\u8f6c\u6362\u3002\u5982\u679c\u6570\u636e\u5e93\u5927\u5c0f\u5199\u654f\u611f\uff0c\u8bf7\u901a\u8fc7\u003Ccode\u003E@Table\u003C/code\u003E\u6ce8\u89e3\u548c\u6570\u636e\u5e93\u4fdd\u6301\u4e00\u81f4\u3002\u003C/p\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"2-2-0-2015-03-11_1\" href=\"#2-2-0-2015-03-11_1\"\u003E\u003C/a\u003E2.2.0 - 2015-03-11\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u65b0\u589e\u003Ccode\u003ESqlMapper\u003C/code\u003E\uff0c\u53ef\u4ee5\u4f7f\u7528MyBatis\u76f4\u63a5\u6267\u884csql\uff0c\u003Ca href=\"http://git.oschina.net/free/Mapper/blob/master/wiki/UseSqlMapper.md\"\u003E\u8be6\u7ec6\u6587\u6863\u003C/a\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"v2-1-0-2015-03-07_1\" href=\"#v2-1-0-2015-03-07_1\"\u003E\u003C/a\u003Ev2.1.0 - 2015-03-07\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\n\u003Cp\u003E\u901a\u7528Mapper\u63a5\u53e3\u589e\u52a0Example\u67e5\u8be2\u65b9\u6cd5\uff0c\u5305\u62ec\u4ee5\u4e0b\u65b9\u6cd5\uff1a\u003C/p\u003E\n\n\u003Cp\u003Eint selectCountByExample(Object example);\u003C/p\u003E\n\n\u003Cp\u003Eint deleteByExample(Object example);\u003C/p\u003E\n\n\u003Cp\u003EList selectByExample(Object example);\u003C/p\u003E\n\n\u003Cp\u003Eint updateByExampleSelective(\u003Ca href=\"/param\" class=\"gfm gfm-team_member \"\u003E@chancelai \u003C/a\u003E(\"record\") T record, \u003Ca href=\"/param\" class=\"gfm gfm-team_member \"\u003E@chancelai \u003C/a\u003E(\"example\") Object example);\u003C/p\u003E\n\n\u003Cp\u003Eint updateByExample(\u003Ca href=\"/param\" class=\"gfm gfm-team_member \"\u003E@chancelai \u003C/a\u003E(\"record\") T record, \u003Ca href=\"/param\" class=\"gfm gfm-team_member \"\u003E@chancelai \u003C/a\u003E(\"example\") Object example);\u003C/p\u003E\n\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003E\u901a\u7528\u003Ccode\u003EExample\u003C/code\u003E\u589e\u52a0\u4e86\u4e00\u4e2a\u003Ccode\u003Eexists\u003C/code\u003E\u7684\u53c2\u6570\uff0c\u5f53\u003Ccode\u003Etrue\u003C/code\u003E\u7684\u65f6\u5019\u5982\u679c\u4f7f\u7528\u7684\u5b57\u6bb5\u4e0d\u5b58\u5728\u4f1a\u629b\u51fa\u5f02\u5e38\uff0c\u003Ccode\u003Efalse\u003C/code\u003E\u65f6\u4e0d\u629b\u51fa\u5f02\u5e38\uff0c\u4f46\u662f\u4e0d\u4f7f\u7528\u8be5\u5b57\u6bb5\u7684\u6761\u4ef6\u3002\u003C/p\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"v2-0-1-2015-02-28_1\" href=\"#v2-0-1-2015-02-28_1\"\u003E\u003C/a\u003EV2.0.1 - 2015-02-28\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u589e\u52a0\u62e6\u622a\u5668\uff0c\u5b8c\u5584\u76f8\u5e94\u7684\u6587\u6863\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"v2-0-0-2015-02-04_1\" href=\"#v2-0-0-2015-02-04_1\"\u003E\u003C/a\u003EV2.0.0 - 2015-02-04\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u589e\u52a0\u4e00\u4e2a\u003Ccode\u003ECommonMapper\u003C/code\u003E\u548c\u5305\u88c5\u7c7b\u003Ccode\u003EEntityMapper\u003C/code\u003E\uff0c\u5efa\u8bae\u4f7f\u7528\u003Ccode\u003EEntityMapper\u003C/code\u003E\u003C/li\u003E\n\u003Cli\u003E\u6709\u5173\u003Ccode\u003EEntityMapper\u003C/code\u003E\u7684\u5185\u5bb9\u8bf7\u770b\u72ec\u7acb\u6587\u6863\uff0c\u8fd9\u4e2a\u7c7b\u8db3\u4ee5\u72ec\u7acb\u6210\u4e00\u4e2a\u5f00\u6e90\u9879\u76ee\u003C/li\u003E\n\u003Cli\u003E\u589e\u52a0\u5bf9JPA\u6ce8\u89e3\u003Ccode\u003EOrderBy\u003C/code\u003E\u7684\u652f\u6301\uff0c\u4ec5\u5bf9\u003Ccode\u003Eselect\u003C/code\u003E\u4e00\u4e2a\u65b9\u6cd5\u6709\u6548\u003C/li\u003E\n\u003C/ul\u003E\n\n\u003Cp\u003E\u7b80\u5355\u8bf4\u660e\uff0c\u4e3a\u4ec0\u4e48\u7248\u672c\u8fd9\u4e48\u5feb\u5c31\u5230\u4e862.0?\uff0c\u56e0\u4e3a\u003Ccode\u003EEntityMapper\u003C/code\u003E\uff0c\u8fd9\u662f\u53e6\u4e00\u79cd\u5f62\u5f0f\u7684\u901a\u7528Mapper\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u8fd9\u91cc\u8bf4\u8bf4\u003Ccode\u003EEntityMapper\u003C/code\u003E\u548c\u901a\u7528Mapper\u7684\u533a\u522b\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u901a\u7528Mapper\u9700\u8981\u6709\u7ee7\u627f\u7684\u63a5\u53e3\uff0c\u9700\u8981\u6307\u5b9a\u6cdb\u578b\u7c7b\u578b\uff0c\u53ef\u4ee5\u7f13\u5b58\uff0c\u548c\u624b\u5199\u7684\u6548\u679c\u4e00\u6837\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u003Ccode\u003EEntityMapper\u003C/code\u003E\u65e0\u9700\u7ee7\u627f\uff0c\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\uff0c\u800c\u4e14\u8fd9\u4e00\u4e2a\u5bf9\u8c61\u5c31\u53ef\u4ee5\u64cd\u4f5c\u5168\u90e8\u7684\u5b9e\u4f53\u5bf9\u8c61\uff08\u548c\u901a\u7528Mapper\u6ce8\u89e3\u8981\u6c42\u4e00\u6837\uff0c\u4e0d\u652f\u6301\u4e3b\u952e\u7b56\u7565\uff09\u548c\u8868\uff0c\u662f\u4e00\u4e2a\u66f4\u63a5\u8fd1Hibernate\u7528\u6cd5\u7684\u7c7b\uff0c\u8fd9\u4e2a\u7c7b\u975e\u5e38\u5f3a\u5927\uff0c\u652f\u6301Mybatis\u751f\u6210\u7684Example\u67e5\u8be2\uff0c\u8fd8\u652f\u6301\u4e00\u4e2a\u901a\u7528Example\u67e5\u8be2\u3002\u003C/p\u003E\n\n\u003Cp\u003E\u003Ccode\u003EEntityMapper\u003C/code\u003E\u529f\u80fd\u66f4\u5168\u9762\uff0c\u4f46\u662f\u4e0d\u652f\u6301\u4e3b\u952e\u7b56\u7565\uff0c\u7531\u4e8e\u8be5\u7c7b\u8db3\u4ee5\u72ec\u7acb\u6210\u4e00\u4e2a\u5f00\u6e90\u9879\u76ee\uff0c\u7b80\u5355\u51e0\u53e5\u4e0d\u80fd\u8bf4\u660e\u7528\u6cd5\uff0c\u56e0\u6b64\u8be6\u7ec6\u5185\u5bb9\u8bf7\u770b\u72ec\u7acb\u7684\u6587\u6863\u3002\u003C/p\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"v1-1-0_1\" href=\"#v1-1-0_1\"\u003E\u003C/a\u003EV1.1.0\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u5b8c\u5584\u6587\u6863\u003C/li\u003E\n\u003Cli\u003E\u89e3\u51b3\u4e3b\u952eselectKey\u7684\u4e00\u4e2abug\u003C/li\u003E\n\u003Cli\u003E\u89e3\u51b3@Column\u6ce8\u89e3\u4e3a\u7a7a\u65f6\u7684bug\u003C/li\u003E\n\u003Cli\u003E\u5b8c\u5584\u81ea\u52a8\u589e\u957f\u7684\u914d\u7f6e\uff0c\u589e\u52a0\u5bf9JDBC\u7684\u652f\u6301\u003Ccode\u003E@GeneratedValue(generator = \u0026quot;JDBC\u0026quot;)\u003C/code\u003E,\u8be6\u7ec6\u8bf7\u770b\u4e0b\u9762\u5173\u4e8e\u4e3b\u952e\u7b56\u7565\u7684\u8be6\u7ec6\u5185\u5bb9\u003C/li\u003E\n\u003Cli\u003E\u589e\u52a0\u4e86\u4e00\u4e2a\u003Ccode\u003EnotEmpty\u003C/code\u003E\u53c2\u6570\uff0c\u8be5\u53c2\u6570\u4f1a\u5f71\u54cd\u6240\u6709\u4f7f\u7528\u003Ccode\u003EgetAllIfColumnNode\u003C/code\u003E\u65b9\u6cd5\u7684\u5730\u65b9,\u5177\u4f53\u5230\u003Ccode\u003EMapper\u0026lt;T\u0026gt;\u003C/code\u003E,\u5f71\u54cd3\u4e2a\u65b9\u6cd5\uff1aselect,selectCount,delete\u3002\u5982\u679c\u8bbe\u7f6e\u4e3a\u003Ccode\u003Etrue\u003C/code\u003E\uff0c\u90a3\u4e48\u003Ccode\u003E\u0026lt;if ...\u003C/code\u003E\u7684\u6761\u4ef6\u4e2d\u4f1a\u5305\u542b\u003Ccode\u003EString\u003C/code\u003E\u7c7b\u578b\u003Ccode\u003Eproperty!=\u0026#39;\u0026#39;\u003C/code\u003E\u7684\u6761\u4ef6\u3002\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"v1-0-0\u6b63\u5f0f\u53d1\u5e03\u7248_1\" href=\"#v1-0-0\u6b63\u5f0f\u53d1\u5e03\u7248_1\"\u003E\u003C/a\u003Ev1.0.0\u6b63\u5f0f\u53d1\u5e03\u7248\u003C/h2\u003E\n\u003Cul class=\"task-list\"\u003E\n\u003Cli\u003E\u003Cp\u003E\u589e\u52a0\u901a\u7528Mapper\u4e13\u7528\u7684MyBatis Generator\u63d2\u4ef6\uff0c\u53ef\u4ee5\u81ea\u52a8\u751f\u6210\u5b9e\u4f53\u7c7b\u6ce8\u89e3\u4ee5\u53caMapper\u63a5\u53e3\u548c\u4e00\u4e2a\u7a7a\u7684xml\u6587\u4ef6\u003C/p\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003E\u63d2\u4ef6\u540e\u7eed\u53ef\u80fd\u4f1a\u589e\u52a0\u66f4\u591a\u7684\u81ea\u52a8\u751f\u6210\u4ee3\u7801\u3002\u003C/p\u003E\u003C/li\u003E\n\u003Cli\u003E\u003Cp\u003E\u6709\u5173\u63d2\u4ef6\u7684\u4f7f\u7528\uff0c\u540e\u7eed\u5b8c\u5584\u6587\u6863\u003C/p\u003E\u003C/li\u003E\n\u003C/ul\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"v0-3-2\u7248\u672c\u8bf4\u660e_1\" href=\"#v0-3-2\u7248\u672c\u8bf4\u660e_1\"\u003E\u003C/a\u003Ev0.3.2\u7248\u672c\u8bf4\u660e\u003C/h2\u003E\n\u003Cp\u003E\u79fb\u9664\u4e86\u003Ccode\u003EMapperInterceptor\u003C/code\u003E\u7c7b\uff0c\u4e0d\u5728\u63d0\u4f9b\u62e6\u622a\u5668\u65b9\u5f0f\u7684\u4f7f\u7528\u3002\u5982\u679c\u6709\u9700\u8981\u53ef\u4ee5\u81ea\u5df1\u4ece0.3.1\u7248\u672c\u83b7\u53d6\u3002\u003C/p\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"v0-3-1\u7248\u672c\u8bf4\u660e_1\" href=\"#v0-3-1\u7248\u672c\u8bf4\u660e_1\"\u003E\u003C/a\u003Ev0.3.1\u7248\u672c\u8bf4\u660e\u003C/h2\u003E\n\u003Cp\u003E\u652f\u6301Spring4\u6cdb\u578b\u6ce8\u5165\uff0c\u8be6\u7ec6\u8bf7\u770b\u6587\u6863\u003Ca href=\"http://git.oschina.net/free/Mapper/blob/master/UseMapperInSpring4.md\"\u003E\u5728Spring4\u4e2d\u4f7f\u7528\u901a\u7528Mapper\u003C/a\u003E \u003C/p\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"v0-3-0\u7248\u672c\u8bf4\u660e_1\" href=\"#v0-3-0\u7248\u672c\u8bf4\u660e_1\"\u003E\u003C/a\u003Ev0.3.0\u7248\u672c\u8bf4\u660e\u003C/h2\u003E\n\u003Cp\u003E\u8fd9\u4e2a\u7248\u672c\u7684\u4e3b\u8981\u76ee\u7684\u662f\u6d88\u9664\u62e6\u622a\u5668\uff0c\u56e0\u6b64\u9488\u5bf9\u5e38\u7528\u7684\u60c5\u51b5\u589e\u52a0\u4e86\u4e24\u79cd\u66f4\u65b9\u4fbf\u7684\u4f7f\u7528\u65b9\u5f0f\u3002\u003C/p\u003E\n\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"v0-2-0\u7248\u672c\u8bf4\u660e_1\" href=\"#v0-2-0\u7248\u672c\u8bf4\u660e_1\"\u003E\u003C/a\u003Ev0.2.0\u7248\u672c\u8bf4\u660e\u003C/h2\u003E\n\u003Cp\u003E\u8be5\u7248\u672c\u505a\u4e86\u5927\u91cf\u7684\u91cd\u6784\uff0c\u5728\u539f\u6709\u57fa\u7840\u4e0a\u589e\u52a0\u4e86\u4e24\u4e2a\u7c7b\uff0c\u5206\u522b\u4e3a\u003Ccode\u003EMapperTemplate\u003C/code\u003E\u548c\u003Ccode\u003EMapperProvider\u003C/code\u003E\uff0c\u5176\u4ed6\u51e0\u4e2a\u7c7b\u90fd\u6709\u76f8\u5f53\u5927\u7684\u6539\u52a8\u3002  \u003C/p\u003E\n\n\u003Cp\u003E\u003Cstrong\u003E\u4f46\u662f\u003C/strong\u003E\uff0c\u8fd9\u6b21\u91cd\u6784\u5e76\u4e0d\u5f71\u54cd\u539f\u6709\u7684\u4e1a\u52a1\u4ee3\u7801\u3002  \u003C/p\u003E\n\n\u003Cp\u003E\u8fd9\u6b21\u91cd\u6784\u7684\u76ee\u7684\u662f\u4e3a\u4e86\u65b9\u4fbf\u5f00\u53d1\u8005\u81ea\u884c\u6269\u5c55\uff0c\u589e\u52a0\u81ea\u5df1\u9700\u8981\u7684\u901a\u7528Mapper\u3002\u8fd9\u6b21\u91cd\u6784\u540e\uff0c\u6269\u5c55\u53d8\u7684\u66f4\u5bb9\u6613\u3002\u7a0d\u540e\u4f1a\u5199\u4e00\u7bc7\u003Cstrong\u003E\u5982\u4f55\u8fdb\u884c\u6269\u5c55\u003C/strong\u003E\u7684\u6587\u6863\u3002  \u003C/p\u003E\n\n\u003Cp\u003E\u8fd9\u6b21\u66f4\u65b0\u8fd8\u4fee\u590dOracle\u5e8f\u5217\u7684BUG\u3002\u003C/p\u003E\n","213172":"\u003Ch2\u003E\u003Ca class=\"anchor\" id=\"\u4e03-\u5e38\u89c1\u95ee\u9898_1\" href=\"#\u4e03-\u5e38\u89c1\u95ee\u9898_1\"\u003E\u003C/a\u003E\u4e03\u3001\u5e38\u89c1\u95ee\u9898\u003C/h2\u003E"}}</script>